|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.annotations.helpers.FieldMapping
public class FieldMapping
A helper class with information about the location of an field annotated with Parsed in a record.
| Constructor Summary | |
|---|---|
FieldMapping(Class<?> beanClass,
Field field,
PropertyWrapper property)
Creates the mapping and identifies how it is mapped (by name or by index) |
|
| Method Summary | |
|---|---|
boolean |
canWrite(Object instance)
Queries whether this field mapping can be applied over a given object instance. |
boolean |
equals(Object o)
|
Field |
getField()
Returns the Field mapped to a column |
String |
getFieldName()
Returns the column name against which this field is mapped. |
Class<?> |
getFieldParent()
Returns the parent class that contains the mapped field. |
Class<?> |
getFieldType()
Returns the type of the mapped field |
int |
getIndex()
Returns the column index against which this field is mapped. |
int |
hashCode()
|
boolean |
isMappedToField()
Returns true if the field is mapped to a column name, otherwise false |
boolean |
isMappedToIndex()
Returns true if the field is mapped to a column index, otherwise false |
Object |
read(Object instance)
Reads the value accessible by this field mapping from a given object |
String |
toString()
|
void |
write(Object instance,
Object value)
Writes a value to the field of a given object instance, whose field is accessible through this field mapping. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FieldMapping(Class<?> beanClass,
Field field,
PropertyWrapper property)
beanClass - the class that contains a the given field.field - a Field annotated with Parsedproperty - the property descriptor of this field, if any. If this bean does not have getters/setters, it will be accessed directly.| Method Detail |
|---|
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean isMappedToIndex()
true if the field is mapped to a column index, otherwise false
true if the field is mapped to a column index, otherwise falsepublic boolean isMappedToField()
true if the field is mapped to a column name, otherwise false
true if the field is mapped to a column name, otherwise falsepublic int getIndex()
public String getFieldName()
null if there's no such association.public Field getField()
Field mapped to a column
Field mapped to a columnpublic Class<?> getFieldParent()
public Class<?> getFieldType()
public boolean canWrite(Object instance)
instance - the object whose type will be verified in order to identify if it contains the mapped field
true if the given instance contains the field/accessor method and can use this field mapping to modify its internal state; otherwise falsepublic Object read(Object instance)
instance - the object whose field, mapped by this field mapping, will be read
public void write(Object instance,
Object value)
instance - the object whose field will be setvalue - the value to set on the given object's field.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||