ColumnMapper interface which allows
users to manually define mappings from attributes/methods of a given class
to columns to be parsed or written.
ColumnMapper
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private ColumnMapping. | |
| private ColumnMapping. | |
| private ColumnMapping. |
| Access | Constructor and Description |
|---|---|
| public | |
| 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. |
| Modifier and Type | Method and Description |
|---|---|
| public void | attributesToColumnNames(Map<String, String>
a map of attribute names associated with a corresponding column name, where:
mappings)
Implements com. |
| public void | attributesToColumns(Map<String, Enum<?>>
a map of attribute names associated with a corresponding column, where:
mappings)
Implements com. |
| public void | attributesToIndexes(Map<String, Integer>
a map of attribute names associated with a corresponding column, where:
mappings)
Implements com. |
| public void | attributeToColumn(String
the name of the attribute.
Use the dot character to access attributes of nested objects,
e.g. attributeName, Enum<?> contact.mobile will target the attribute "mobile"
from a Contact attribute inside a Customer class.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. |
| public void | attributeToColumnName(String
the name of the attribute.
Use the dot character to access attributes of nested objects,
e.g. attributeName, String contact.mobile will target the attribute "mobile"
from a Contact attribute inside a Customer class.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. |
| public void | attributeToIndex(String
the name of the attribute.
Use the dot character to access attributes of nested objects,
e.g. attributeName, int contact.mobile will target the attribute "mobile"
from a Contact attribute inside a Customer class.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. |
| public ColumnMapper | clone()
Overrides java. Implements com. |
| private static String | |
| public Set | Returns: the names of nested objects to visit from the current objectReturns 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 namesReturns object the nesting path associated with the current mapping. |
| public boolean | Returns: true if the given method or attribute has been mapped to a columna descriptor of getter/setter methods (can be method, String null)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:
mappings)
Implements com. |
| public void | methodsToColumns(Map<String, Enum<?>>
a map of methods names associated with a corresponding column, where:
mappings)
Implements com. |
| public void | methodsToIndexes(Map<String, Integer>
a map of methods names associated with a corresponding column position, where:
mappings)
Implements com. |
| private void | |
| public void | methodToColumn(String
the name of the method.
Use the dot character to access methods of nested objects,
* e.g. methodName, Enum<?> contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing,
* from a Contact attribute inside a Customer class.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. |
| public void | methodToColumn(String
the name of the setter method.
Use the dot character to access methods of nested objects,
e.g. setterName, Class<?> contact.mobile will target the setter method "mobile(String)"
from a Contact attribute inside a Customer 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. |
| private void | |
| public void | methodToColumnName(String
the name of the method.
Use the dot character to access methods of nested objects,
e.g. methodName, String contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing,
from a Contact attribute inside a Customer class.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. |
| public void | methodToColumnName(String
the name of the setter method.
Use the dot character to access methods of nested objects,
e.g. setterName, Class<?> contact.mobile will target the setter method "mobile(String)"
from a Contact attribute inside a Customer 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. |
| private void | |
| public void | methodToIndex(String
the name of the method.
Use the dot character to access methods of nested objects,
* e.g. methodName, int contact.mobile will target the method "mobile(String)" when parsing, or "String mobile()" when writing,
* from a Contact attribute inside a Customer class.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. |
| public void | methodToIndex(String
the name of the setter method.
Use the dot character to access methods of nested objects,
e.g. setterName, Class<?> contact.mobile will target the setter method "mobile(String)"
from a Contact attribute inside a Customer 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. |
| public void | remove(String
the name of the method or attribute to be removed. methodOrAttributeName)Implements com. |
| public boolean | Returns: true if the mapping has been successfully updated.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 method)null)Updates the mapping of a attribute/method so a mapped class member can target a user provided column. |
| attributeMapping | back to summary |
|---|---|
| private ColumnMapping. | |
| methodMapping | back to summary |
|---|---|
| private ColumnMapping. | |
| methodNameMapping | back to summary |
|---|---|
| private ColumnMapping. | |
| ColumnMapping | back to summary |
|---|---|
| public ColumnMapping() Creates a new column mapping instance | |
| ColumnMapping | back to summary |
|---|---|
| public ColumnMapping(String prefix, ColumnMapping parent) Creates a nested column mapping instance for handling nested attributes. For internal use.
| |
| attributesToColumnNames | back to summary |
|---|---|
| public void attributesToColumnNames(Map<String, String> mappings) Implements com. Doc from com. Maps multiple attributes to multiple column names.
| |
| attributesToColumns | back to summary |
|---|---|
| public void attributesToColumns(Map<String, Enum<?>> mappings) Implements com. Doc from com. Maps multiple attributes to multiple columns.
| |
| attributesToIndexes | back to summary |
|---|---|
| public void attributesToIndexes(Map<String, Integer> mappings) Implements com. Doc from com. Maps multiple attributes to multiple column positions.
| |
| attributeToColumn | back to summary |
|---|---|
| public void attributeToColumn(String attributeName, Enum<?> column) Implements com. Doc from com. Maps an attribute to a column.
| |
| attributeToColumnName | back to summary |
|---|---|
| public void attributeToColumnName(String attributeName, String columnName) Implements com. Doc from com. Maps an attribute to a column name.
| |
| attributeToIndex | back to summary |
|---|---|
| public void attributeToIndex(String attributeName, int columnIndex) Implements com. Doc from com. Maps an attribute to a column position.
| |
| clone | back to summary |
|---|---|
| public ColumnMapper clone() Overrides java. Implements com. Doc from com. Creates a deep copy of this object with all its mappings. Changes to the clone won't affect the original instance.
| |
| getCurrentAttributePrefix | back to summary |
|---|---|
| private static String getCurrentAttributePrefix(String prefix, String name) | |
| getNestedAttributeNames | back to summary |
|---|---|
| public Set Returns the first-level names of all nested members whose attributes or methods have been mapped | |
| getPrefix | back to summary |
|---|---|
| public String getPrefix() Returns object the nesting path associated with the current mapping.
| |
| isMapped | back to summary |
|---|---|
| public boolean isMapped(MethodDescriptor method, String targetName) Tests whether a method or attribute has been mapped to a column.
| |
| methodsToColumnNames | back to summary |
|---|---|
| public void methodsToColumnNames(Map<String, String> mappings) Implements com. Doc from com. Maps multiple methods to multiple column names.
| |
| methodsToColumns | back to summary |
|---|---|
| public void methodsToColumns(Map<String, Enum<?>> mappings) Implements com. Doc from com. Maps multiple methods to multiple columns.
| |
| methodsToIndexes | back to summary |
|---|---|
| public void methodsToIndexes(Map<String, Integer> mappings) Implements com. Doc from com. Maps multiple methods to multiple column positions.
| |
| methodToColumn | back to summary |
|---|---|
| private void methodToColumn(MethodDescriptor method, Enum<?> column) | |
| methodToColumn | back to summary |
|---|---|
| public void methodToColumn(String methodName, Enum<?> column) Implements com. Doc from com. 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
| |
| methodToColumn | back to summary |
|---|---|
| public void methodToColumn(String setterName, Class<?> parameterType, Enum<?> column) Implements com. Doc from com. Maps a setter method to a column. Use when
| |
| methodToColumnName | back to summary |
|---|---|
| private void methodToColumnName(MethodDescriptor method, String columnName) | |
| methodToColumnName | back to summary |
|---|---|
| public void methodToColumnName(String methodName, String columnName) Implements com. Doc from com. 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 | back to summary |
|---|---|
| public void methodToColumnName(String setterName, Class<?> parameterType, String columnName) Implements com. Doc from com. Maps a setter method to a column name. Use when
| |
| methodToIndex | back to summary |
|---|---|
| private void methodToIndex(MethodDescriptor method, int columnIndex) | |
| methodToIndex | back to summary |
|---|---|
| public void methodToIndex(String methodName, int columnIndex) Implements com. Doc from com. 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
| |
| methodToIndex | back to summary |
|---|---|
| public void methodToIndex(String setterName, Class<?> parameterType, int columnIndex) Implements com. Doc from com. Maps a setter method to a column position. Use when
| |
| remove | back to summary |
|---|---|
| public void remove(String methodOrAttributeName) Implements com. Doc from com. Removes any mappings that target a given method or attribute name.
| |
| updateMapping | back 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.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method 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. |
| 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. |
| 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. |
| MethodMapping | back to summary |
|---|---|
| public MethodMapping(String prefix, ColumnMapping. | |
| findKey | back to summary |
|---|---|
| pack-priv MethodDescriptor findKey(String nameWithPrefix) Implements abstract com. Doc from com. Locates a given key based on an attribute or method name.
| |
| getKeyPrefix | back to summary |
|---|---|
| pack-priv String getKeyPrefix(String prefix, MethodDescriptor key) Implements abstract com. Doc from com. Returns the prefix of a given key, i.e. the current nested object that is being targeted.
| |
| prefixKey | back to summary |
|---|---|
| pack-priv MethodDescriptor prefixKey(String prefix, MethodDescriptor key) Implements abstract com. Doc from com. Transforms the key so it can work with the given prefix.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method 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. |
| 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. |
| 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. |
| NameMapping | back to summary |
|---|---|
| public NameMapping(String prefix, ColumnMapping. | |
| findKey | back to summary |
|---|---|
| pack-priv String findKey(String nameWithPrefix) Implements abstract com. Doc from com. Locates a given key based on an attribute or method name. | |
| getKeyPrefix | back to summary |
|---|---|
| pack-priv String getKeyPrefix(String prefix, String key) Implements abstract com. Doc from com. Returns the prefix of a given key, i.e. the current nested object that is being targeted.
| |
| prefixKey | back to summary |
|---|---|
| pack-priv String prefixKey(String prefix, String key) Implements abstract com. Doc from com. Transforms the key so it can work with the given prefix. | |