org.nerd4j.csv.conf.mapping.CSVConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nerd4j-csv Show documentation
Show all versions of nerd4j-csv Show documentation
CSV manipulation library.
/*
* #%L
* Nerd4j CSV
* %%
* Copyright (C) 2013 Nerd4j
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
package org.nerd4j.csv.conf.mapping;
import java.util.HashMap;
import java.util.Map;
/**
* Represents the configuration obtained parsing
* annotated beans and XML files.
*
* @author Nerd4j Team
*/
public final class CSVConfiguration implements Cloneable
{
/** The register items configuration. */
private CSVRegisterConf register;
/** Map of configured readers. */
private Map parsers;
/** Map of configured writers. */
private Map formatters;
/** Map of configured readers. */
private Map readers;
/** Map of configured writers. */
private Map writers;
/**
* Default constructor.
*
*/
public CSVConfiguration()
{
super();
this.register = new CSVRegisterConf();
this.readers = new HashMap();
this.writers = new HashMap();
this.parsers = new HashMap();
this.formatters = new HashMap();
}
/* ******************* */
/* GETTERS & SETTERS */
/* ******************* */
public CSVRegisterConf getRegister()
{
return register;
}
public Map getReaders()
{
return readers;
}
public Map getWriters()
{
return writers;
}
public Map getParsers()
{
return parsers;
}
public Map getFormatters()
{
return formatters;
}
/* ******************* */
/* INTERFACE METHODS */
/* ******************* */
/**
* {@inheritDoc}
*/
@Override
public CSVConfiguration clone() throws CloneNotSupportedException
{
final CSVConfiguration clone = (CSVConfiguration) super.clone();
clone.register = this.register != null ? this.register.clone() : null;
if( readers != null )
{
clone.readers = new HashMap( this.readers.size() );
for( Map.Entry entry : this.readers.entrySet() )
clone.readers.put( entry.getKey(), entry.getValue() != null ? entry.getValue().clone() : null );
}
if( writers != null )
{
clone.writers = new HashMap( this.writers.size() );
for( Map.Entry entry : this.writers.entrySet() )
clone.writers.put( entry.getKey(), entry.getValue() != null ? entry.getValue().clone() : null );
}
if( parsers != null )
{
clone.parsers = new HashMap( this.parsers.size() );
for( Map.Entry entry : this.parsers.entrySet() )
clone.parsers.put( entry.getKey(), entry.getValue() != null ? entry.getValue().clone() : null );
}
if( formatters != null )
{
clone.formatters = new HashMap( this.formatters.size() );
for( Map.Entry entry : this.formatters.entrySet() )
clone.formatters.put( entry.getKey(), entry.getValue() != null ? entry.getValue().clone() : null );
}
return clone;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy