Top Description Inners Fields Constructors Methods
com.univocity.parsers.common.fields

public final Class ColumnMapping

extends Object
implements ColumnMapper
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.common.fields.ColumnMapper, java.lang.Cloneable
Imports
com.univocity.parsers.annotations.helpers.*, java.util.*

Implementation the ColumnMapper interface which allows users to manually define mappings from attributes/methods of a given class to columns to be parsed or written.
See Also
ColumnMapper

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
private ColumnMapping.NameMapping
private ColumnMapping.MethodMapping
private ColumnMapping.NameMapping

Constructor Summary

AccessConstructor and Description
public
ColumnMapping()

Creates a new column mapping instance

public
ColumnMapping(String
the current nesting path, denoted by a dot separated string of attribute names
prefix
,
ColumnMapping
the mappings of the parent object in the nested structure.
parent
)

Creates a nested column mapping instance for handling nested attributes.

Method Summary

Modifier and TypeMethod and Description
public void
attributesToColumnNames(Map<String, String>
a map of attribute names associated with a corresponding column name, where:
  • Each key is the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
  • Each value is the name of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
mappings
)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributesToColumnNames.

Maps multiple attributes to multiple column names.
public void
attributesToColumns(Map<String, Enum<?>>
a map of attribute names associated with a corresponding column, where:
  • Each key is the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
  • Each value is an enumeration representing the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
mappings
)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributesToColumns.

Maps multiple attributes to multiple columns.
public void
attributesToIndexes(Map<String, Integer>
a map of attribute names associated with a corresponding column, where:
  • Each key is the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
  • Each value is an integer representing the position of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
mappings
)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributesToIndexes.

Maps multiple attributes to multiple column positions.
public void
attributeToColumn(String
the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
attributeName
,
Enum<?>
an enumeration representing the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
column
)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributeToColumn.

Maps an attribute to a column.
public void
attributeToColumnName(String
the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
attributeName
,
String
the name of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
columnName
)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributeToColumnName.

Maps an attribute to a column name.
public void
attributeToIndex(String
the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
attributeName
,
int
the position of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
columnIndex
)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributeToIndex.

Maps an attribute to a column position.
public ColumnMapper
clone()

Overrides java.lang.Object.clone.

Implements com.univocity.parsers.common.fields.ColumnMapper.clone.

Creates a deep copy of this object with all its mappings.
private static String
public Set<String>

Returns:

the names of nested objects to visit from the current object
getNestedAttributeNames
()

Returns the first-level names of all nested members whose attributes or methods have been mapped

public String

Returns:

a dot separated string of nested attribute names
getPrefix
()

Returns object the nesting path associated with the current mapping.

public boolean

Returns:

true if the given method or attribute has been mapped to a column
isMapped
(MethodDescriptor
a descriptor of getter/setter methods (can be null)
method
,
String
name of a method or attribute
targetName
)

Tests whether a method or attribute has been mapped to a column.

public void
methodsToColumnNames(Map<String, String>
a map of methods names associated with a corresponding column name, where:
  • Each key is the name of a method. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.
  • Each value is the name of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
mappings
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodsToColumnNames.

Maps multiple methods to multiple column names.
public void
methodsToColumns(Map<String, Enum<?>>
a map of methods names associated with a corresponding column, where:
  • Each key is the name of a method. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.
  • Each value is an enumeration representing the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
mappings
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodsToColumns.

Maps multiple methods to multiple columns.
public void
methodsToIndexes(Map<String, Integer>
a map of methods names associated with a corresponding column position, where:
  • Each key is the name of a method. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.
  • Each value is an integer representing the position of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
mappings
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodsToIndexes.

Maps multiple methods to multiple column positions.
private void
public void
methodToColumn(String
the name of the method. Use the dot character to access methods of nested objects, * e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, * from a Contact attribute inside a Customer class.
methodName
,
Enum<?>
an enumeration representing the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
column
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumn.

Maps a method to a column.
public void
methodToColumn(String
the name of the setter method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the setter method "mobile(String)" from a Contact attribute inside a Customer class.
setterName
,
Class<?>
the type of the parameter used in the given setter name.
parameterType
,
Enum<?>
an enumeration representing the column that when parsing, will be read from to invoke given setter method of an object
column
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumn.

Maps a setter method to a column.
private void
public void
methodToColumnName(String
the name of the method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.
methodName
,
String
the name of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
columnName
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumnName.

Maps a method to a column name.
public void
methodToColumnName(String
the name of the setter method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the setter method "mobile(String)" from a Contact attribute inside a Customer class.
setterName
,
Class<?>
the type of the parameter used in the given setter name.
parameterType
,
String
the name of the column that when parsing, will be read from to invoke given setter method of an object
columnName
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumnName.

Maps a setter method to a column name.
private void
methodToIndex(MethodDescriptor method, int columnIndex)

public void
methodToIndex(String
the name of the method. Use the dot character to access methods of nested objects, * e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, * from a Contact attribute inside a Customer class.
methodName
,
int
the position of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
columnIndex
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToIndex.

Maps a method to a column position.
public void
methodToIndex(String
the name of the setter method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the setter method "mobile(String)" from a Contact attribute inside a Customer class.
setterName
,
Class<?>
the type of the parameter used in the given setter name.
parameterType
,
int
the position of the column that when parsing, will be read from to invoke given setter method of an object
columnIndex
)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToIndex.

Maps a setter method to a column position.
public void
remove(String
the name of the method or attribute to be removed.
methodOrAttributeName
)

Implements com.univocity.parsers.common.fields.ColumnMapper.remove.

Removes any mappings that target a given method or attribute name.
public boolean

Returns:

true if the mapping has been successfully updated.
updateMapping
(FieldMapping
a class member that has should be mapped to a column
fieldMapping
,
String
name of a method or attribute
targetName
,
MethodDescriptor
a descriptor of getter/setter methods (can be null)
method
)

Updates the mapping of a attribute/method so a mapped class member can target a user provided column.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeMappingback to summary
private ColumnMapping.NameMapping attributeMapping
methodMappingback to summary
private ColumnMapping.MethodMapping methodMapping
methodNameMappingback to summary
private ColumnMapping.NameMapping methodNameMapping

Constructor Detail

ColumnMappingback to summary
public ColumnMapping()

Creates a new column mapping instance

ColumnMappingback to summary
public ColumnMapping(String prefix, ColumnMapping parent)

Creates a nested column mapping instance for handling nested attributes. For internal use.

Parameters
prefix:String

the current nesting path, denoted by a dot separated string of attribute names

parent:ColumnMapping

the mappings of the parent object in the nested structure.

Method Detail

attributesToColumnNamesback to summary
public void attributesToColumnNames(Map<String, String> mappings)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributesToColumnNames.

Doc from com.univocity.parsers.common.fields.ColumnMapper.attributesToColumnNames.

Maps multiple attributes to multiple column names.

Parameters
mappings:Map<String, String>

a map of attribute names associated with a corresponding column name, where:

  • Each key is the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
  • Each value is the name of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
Annotations
@Override
attributesToColumnsback to summary
public void attributesToColumns(Map<String, Enum<?>> mappings)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributesToColumns.

Doc from com.univocity.parsers.common.fields.ColumnMapper.attributesToColumns.

Maps multiple attributes to multiple columns.

Parameters
mappings:Map<String, Enum<?>>

a map of attribute names associated with a corresponding column, where:

  • Each key is the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
  • Each value is an enumeration representing the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
Annotations
@Override
attributesToIndexesback to summary
public void attributesToIndexes(Map<String, Integer> mappings)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributesToIndexes.

Doc from com.univocity.parsers.common.fields.ColumnMapper.attributesToIndexes.

Maps multiple attributes to multiple column positions.

Parameters
mappings:Map<String, Integer>

a map of attribute names associated with a corresponding column, where:

  • Each key is the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.
  • Each value is an integer representing the position of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;
Annotations
@Override
attributeToColumnback to summary
public void attributeToColumn(String attributeName, Enum<?> column)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributeToColumn.

Doc from com.univocity.parsers.common.fields.ColumnMapper.attributeToColumn.

Maps an attribute to a column.

Parameters
attributeName:String

the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.

column:Enum<?>

an enumeration representing the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;

Annotations
@Override
attributeToColumnNameback to summary
public void attributeToColumnName(String attributeName, String columnName)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributeToColumnName.

Doc from com.univocity.parsers.common.fields.ColumnMapper.attributeToColumnName.

Maps an attribute to a column name.

Parameters
attributeName:String

the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.

columnName:String

the name of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;

Annotations
@Override
attributeToIndexback to summary
public void attributeToIndex(String attributeName, int columnIndex)

Implements com.univocity.parsers.common.fields.ColumnMapper.attributeToIndex.

Doc from com.univocity.parsers.common.fields.ColumnMapper.attributeToIndex.

Maps an attribute to a column position.

Parameters
attributeName:String

the name of the attribute. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the attribute "mobile" from a Contact attribute inside a Customer class.

columnIndex:int

the position of the column that: (a) when parsing, will be read from to populate the given attribute of an object; (b) when writing, will receive the value of the given attribute of an object;

Annotations
@Override
cloneback to summary
public ColumnMapper clone()

Overrides java.lang.Object.clone.

Implements com.univocity.parsers.common.fields.ColumnMapper.clone.

Doc from com.univocity.parsers.common.fields.ColumnMapper.clone.

Creates a deep copy of this object with all its mappings. Changes to the clone won't affect the original instance.

Returns:ColumnMapper

a clone of the current mappings.

Annotations
@Override
getCurrentAttributePrefixback to summary
private static String getCurrentAttributePrefix(String prefix, String name)
getNestedAttributeNamesback to summary
public Set<String> getNestedAttributeNames()

Returns the first-level names of all nested members whose attributes or methods have been mapped

Returns:Set<String>

the names of nested objects to visit from the current object

getPrefixback to summary
public String getPrefix()

Returns object the nesting path associated with the current mapping.

Returns:String

a dot separated string of nested attribute names

isMappedback to summary
public boolean isMapped(MethodDescriptor method, String targetName)

Tests whether a method or attribute has been mapped to a column.

Parameters
method:MethodDescriptor

a descriptor of getter/setter methods (can be null)

targetName:String

name of a method or attribute

Returns:boolean

true if the given method or attribute has been mapped to a column

methodsToColumnNamesback to summary
public void methodsToColumnNames(Map<String, String> mappings)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodsToColumnNames.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodsToColumnNames.

Maps multiple methods to multiple column names.

Parameters
mappings:Map<String, String>

a map of methods names associated with a corresponding column name, where:

  • Each key is the name of a method. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.
  • Each value is the name of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
Annotations
@Override
methodsToColumnsback to summary
public void methodsToColumns(Map<String, Enum<?>> mappings)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodsToColumns.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodsToColumns.

Maps multiple methods to multiple columns.

Parameters
mappings:Map<String, Enum<?>>

a map of methods names associated with a corresponding column, where:

  • Each key is the name of a method. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.
  • Each value is an enumeration representing the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
Annotations
@Override
methodsToIndexesback to summary
public void methodsToIndexes(Map<String, Integer> mappings)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodsToIndexes.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodsToIndexes.

Maps multiple methods to multiple column positions.

Parameters
mappings:Map<String, Integer>

a map of methods names associated with a corresponding column position, where:

  • Each key is the name of a method. Use the dot character to access attributes of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.
  • Each value is an integer representing the position of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;
Annotations
@Override
methodToColumnback to summary
private void methodToColumn(MethodDescriptor method, Enum<?> column)
methodToColumnback to summary
public void methodToColumn(String methodName, Enum<?> column)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumn.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodToColumn.

Maps a method to a column. When parsing, only "setter" methods will be used i.e. the given method accepts one parameter. If the method is overridden, use methodToColumnName(String, Class, String) to specify the exact parameter type to match the appropriate setter method. When writing, only "getter" methods will be used i.e. the given method doesn't accept any parameters and returns a value.

Parameters
methodName:String

the name of the method. Use the dot character to access methods of nested objects, * e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, * from a Contact attribute inside a Customer class.

column:Enum<?>

an enumeration representing the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;

Annotations
@Override
methodToColumnback to summary
public void methodToColumn(String setterName, Class<?> parameterType, Enum<?> column)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumn.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodToColumn.

Maps a setter method to a column. Use when methodToColumnName(String, String) is not enough to uniquely identify the method you need (e.g. when there are overloaded methods with different parameter types) Used only for parsing. Will be ignored when writing.

Parameters
setterName:String

the name of the setter method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the setter method "mobile(String)" from a Contact attribute inside a Customer class.

parameterType:Class<?>

the type of the parameter used in the given setter name.

column:Enum<?>

an enumeration representing the column that when parsing, will be read from to invoke given setter method of an object

Annotations
@Override
methodToColumnNameback to summary
private void methodToColumnName(MethodDescriptor method, String columnName)
methodToColumnNameback to summary
public void methodToColumnName(String methodName, String columnName)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumnName.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodToColumnName.

Maps a method to a column name. When parsing, only "setter" methods will be used i.e. the given method accepts one parameter. If the method is overridden, use methodToColumnName(String, Class, String) to specify the exact parameter type to match the appropriate setter method. When writing, only "getter" methods will be used i.e. the given method doesn't accept any parameters and returns a value.

Parameters
methodName:String

the name of the method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, from a Contact attribute inside a Customer class.

columnName:String

the name of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;

Annotations
@Override
methodToColumnNameback to summary
public void methodToColumnName(String setterName, Class<?> parameterType, String columnName)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToColumnName.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodToColumnName.

Maps a setter method to a column name. Use when methodToColumnName(String, String) is not enough to uniquely identify the method you need (e.g. when there are overloaded methods with different parameter types) Used only for parsing. Will be ignored when writing.

Parameters
setterName:String

the name of the setter method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the setter method "mobile(String)" from a Contact attribute inside a Customer class.

parameterType:Class<?>

the type of the parameter used in the given setter name.

columnName:String

the name of the column that when parsing, will be read from to invoke given setter method of an object

Annotations
@Override
methodToIndexback to summary
private void methodToIndex(MethodDescriptor method, int columnIndex)
methodToIndexback to summary
public void methodToIndex(String methodName, int columnIndex)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToIndex.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodToIndex.

Maps a method to a column position. When parsing, only "setter" methods will be used i.e. the given method accepts one parameter. If the method is overridden, use methodToColumnName(String, Class, String) to specify the exact parameter type to match the appropriate setter method. When writing, only "getter" methods will be used i.e. the given method doesn't accept any parameters and returns a value.

Parameters
methodName:String

the name of the method. Use the dot character to access methods of nested objects, * e.g. contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing, * from a Contact attribute inside a Customer class.

columnIndex:int

the position of the column that: (a) when parsing, will be read from to invoke given setter method of an object; (b) when writing, will receive the value returned by the given getter method of an object;

Annotations
@Override
methodToIndexback to summary
public void methodToIndex(String setterName, Class<?> parameterType, int columnIndex)

Implements com.univocity.parsers.common.fields.ColumnMapper.methodToIndex.

Doc from com.univocity.parsers.common.fields.ColumnMapper.methodToIndex.

Maps a setter method to a column position. Use when methodToColumnName(String, String) is not enough to uniquely identify the method you need (e.g. when there are overloaded methods with different parameter types) Used only for parsing. Will be ignored when writing.

Parameters
setterName:String

the name of the setter method. Use the dot character to access methods of nested objects, e.g. contact.mobile will target the setter method "mobile(String)" from a Contact attribute inside a Customer class.

parameterType:Class<?>

the type of the parameter used in the given setter name.

columnIndex:int

the position of the column that when parsing, will be read from to invoke given setter method of an object

Annotations
@Override
removeback to summary
public void remove(String methodOrAttributeName)

Implements com.univocity.parsers.common.fields.ColumnMapper.remove.

Doc from com.univocity.parsers.common.fields.ColumnMapper.remove.

Removes any mappings that target a given method or attribute name.

Parameters
methodOrAttributeName:String

the name of the method or attribute to be removed.

updateMappingback to summary
public boolean updateMapping(FieldMapping fieldMapping, String targetName, MethodDescriptor method)

Updates the mapping of a attribute/method so a mapped class member can target a user provided column.

Parameters
fieldMapping:FieldMapping

a class member that has should be mapped to a column

targetName:String

name of a method or attribute

method:MethodDescriptor

a descriptor of getter/setter methods (can be null)

Returns:boolean

true if the mapping has been successfully updated.

com.univocity.parsers.common.fields back to summary

private Class ColumnMapping.MethodMapping

extends AbstractColumnMapping<MethodDescriptor>
Class Inheritance

Field Summary

Inherited from com.univocity.parsers.common.fields.AbstractColumnMapping:
mappingprefix

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv MethodDescriptor
findKey(String
name of the attribute or method, prefixed with nested object names that identify the path to the target class member.
nameWithPrefix
)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.findKey.

Locates a given key based on an attribute or method name.
pack-priv String
getKeyPrefix(String
the current prefix - a dot separated string with nested attribute names
prefix
,
MethodDescriptor
the attribute name or method definition. If its own prefix starts with the given prefix, the next element after the dot will be returned (if any)
key
)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.getKeyPrefix.

Returns the prefix of a given key, i.e. the current nested object that is being targeted.
pack-priv MethodDescriptor
prefixKey(String
the current object nesting level, denoted by a dot-separated string of nested attribute names.
prefix
,
MethodDescriptor
the key to transform.
key
)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.prefixKey.

Transforms the key so it can work with the given prefix.
Inherited from com.univocity.parsers.common.fields.AbstractColumnMapping:
cloneextractPrefixesisMappedmapToColumnmapToColumnIndexmapToColumnIndexesmapToColumnNamemapToColumnNamesmapToColumnsremoveupdateFieldMapping

Constructor Detail

MethodMappingback to summary
public MethodMapping(String prefix, ColumnMapping.MethodMapping parent)

Method Detail

findKeyback to summary
pack-priv MethodDescriptor findKey(String nameWithPrefix)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.findKey.

Doc from com.univocity.parsers.common.fields.AbstractColumnMapping.findKey.

Locates a given key based on an attribute or method name.

Parameters
nameWithPrefix:String

name of the attribute or method, prefixed with nested object names that identify the path to the target class member.

Returns:MethodDescriptor

the key formed with the given attribute name or method definition

Annotations
@Override
getKeyPrefixback to summary
pack-priv String getKeyPrefix(String prefix, MethodDescriptor key)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.getKeyPrefix.

Doc from com.univocity.parsers.common.fields.AbstractColumnMapping.getKeyPrefix.

Returns the prefix of a given key, i.e. the current nested object that is being targeted.

Parameters
prefix:String

the current prefix - a dot separated string with nested attribute names

key:MethodDescriptor

the attribute name or method definition. If its own prefix starts with the given prefix, the next element after the dot will be returned (if any)

Returns:String

the name of the next nested object relative to the current prefix.

Annotations
@Override
prefixKeyback to summary
pack-priv MethodDescriptor prefixKey(String prefix, MethodDescriptor key)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.prefixKey.

Doc from com.univocity.parsers.common.fields.AbstractColumnMapping.prefixKey.

Transforms the key so it can work with the given prefix.

Parameters
prefix:String

the current object nesting level, denoted by a dot-separated string of nested attribute names.

key:MethodDescriptor

the key to transform.

Returns:MethodDescriptor

the transformed key or null if the key can't be used with the given prefix

Annotations
@Override
com.univocity.parsers.common.fields back to summary

private Class ColumnMapping.NameMapping

extends AbstractColumnMapping<String>
Class Inheritance

Field Summary

Inherited from com.univocity.parsers.common.fields.AbstractColumnMapping:
mappingprefix

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv String
findKey(String
name of the attribute or method, prefixed with nested object names that identify the path to the target class member.
nameWithPrefix
)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.findKey.

Locates a given key based on an attribute or method name.
pack-priv String
getKeyPrefix(String
the current prefix - a dot separated string with nested attribute names
prefix
,
String
the attribute name or method definition. If its own prefix starts with the given prefix, the next element after the dot will be returned (if any)
key
)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.getKeyPrefix.

Returns the prefix of a given key, i.e. the current nested object that is being targeted.
pack-priv String
prefixKey(String
the current object nesting level, denoted by a dot-separated string of nested attribute names.
prefix
,
String
the key to transform.
key
)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.prefixKey.

Transforms the key so it can work with the given prefix.
Inherited from com.univocity.parsers.common.fields.AbstractColumnMapping:
cloneextractPrefixesisMappedmapToColumnmapToColumnIndexmapToColumnIndexesmapToColumnNamemapToColumnNamesmapToColumnsremoveupdateFieldMapping

Constructor Detail

NameMappingback to summary
public NameMapping(String prefix, ColumnMapping.NameMapping parent)

Method Detail

findKeyback to summary
pack-priv String findKey(String nameWithPrefix)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.findKey.

Doc from com.univocity.parsers.common.fields.AbstractColumnMapping.findKey.

Locates a given key based on an attribute or method name.

Parameters
nameWithPrefix:String

name of the attribute or method, prefixed with nested object names that identify the path to the target class member.

Returns:String

the key formed with the given attribute name or method definition

Annotations
@Override
getKeyPrefixback to summary
pack-priv String getKeyPrefix(String prefix, String key)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.getKeyPrefix.

Doc from com.univocity.parsers.common.fields.AbstractColumnMapping.getKeyPrefix.

Returns the prefix of a given key, i.e. the current nested object that is being targeted.

Parameters
prefix:String

the current prefix - a dot separated string with nested attribute names

key:String

the attribute name or method definition. If its own prefix starts with the given prefix, the next element after the dot will be returned (if any)

Returns:String

the name of the next nested object relative to the current prefix.

Annotations
@Override
prefixKeyback to summary
pack-priv String prefixKey(String prefix, String key)

Implements abstract com.univocity.parsers.common.fields.AbstractColumnMapping.prefixKey.

Doc from com.univocity.parsers.common.fields.AbstractColumnMapping.prefixKey.

Transforms the key so it can work with the given prefix.

Parameters
prefix:String

the current object nesting level, denoted by a dot-separated string of nested attribute names.

key:String

the key to transform.

Returns:String

the transformed key or null if the key can't be used with the given prefix

Annotations
@Override