olg.csv.bean.annotations.processor
Class ColumnProcessor<B>

Package class diagram package ColumnProcessor
java.lang.Object
  extended by olg.csv.bean.annotations.processor.ColumnProcessor<B>
Type Parameters:
B - the bean on which research its fields annoted with column annotation

public final class ColumnProcessor<B>
extends Object

This class is responsible for processing the @Column annotation.


Field Summary
private  Class<B> clazz
          the class of the bean on which research its fields annoted with column annotation.
private static String DEFAULT_DEFAULT_VALUE
          Default value assigned as defaultValue column attribute.
private static org.slf4j.Logger LOGGER
          Class logger.
private static String NULL_DEFAULT_VALUE
          "null" as default value.
 
Constructor Summary
ColumnProcessor(Class<B> clazz)
          Constructor.
 
Method Summary
private  boolean checkConcreteClass(Field field, Class<?> fieldConcreteClass)
          Check if a class is concrete.
private  boolean chekcAsSubClass(Field field, Column column)
          check if the concrete class declared on a column is a subclass of a field.
private  String getDefaultValue(Column column)
          Return the default value defined on a column annotation.
 boolean getReadingProcessor(int translate, Field field, List<IPropertyProcessor<B>> propertyProcessors, Map<Integer,Integer> map)
          Complete a list with the propertyProcessor built from the column annotation setted on a field.
 boolean getWritingProcessor(Field field, Map<Integer,List<CellProcessor<B>>> map)
          Complete a map with the cellprocessor built from the column annotation setted on a field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
Class logger.


DEFAULT_DEFAULT_VALUE

private static final String DEFAULT_DEFAULT_VALUE
Default value assigned as defaultValue column attribute. Used to indicate the default value is null.

See Also:
Constant Field Values

NULL_DEFAULT_VALUE

private static final String NULL_DEFAULT_VALUE
"null" as default value. Used to indicate the default value is the string "null".

See Also:
Constant Field Values

clazz

private Class<B> clazz
the class of the bean on which research its fields annoted with column annotation.

Constructor Detail

ColumnProcessor

public ColumnProcessor(Class<B> clazz)
Constructor.

Parameters:
clazz - the class of the bean.
Method Detail

getWritingProcessor

public boolean getWritingProcessor(Field field,
                                   Map<Integer,List<CellProcessor<B>>> map)
Complete a map with the cellprocessor built from the column annotation setted on a field.

Parameters:
field - the field (of the beanClass) from which build the cell processor.
map - the map to complete with the CellProcessor built from column annotation setted on the field. the keys are the cell num target of the cellProcessor.
Returns:
true if no error happens during this operation.

getReadingProcessor

public boolean getReadingProcessor(int translate,
                                   Field field,
                                   List<IPropertyProcessor<B>> propertyProcessors,
                                   Map<Integer,Integer> map)
Complete a list with the propertyProcessor built from the column annotation setted on a field.

Parameters:
translate - column index to add to the column num found on the field. Useful to define the index of a field herited by an embedded attribute.
field - the field (of the beanClass) from which read the Column annotation
propertyProcessors - the list to complete
map - the map to complete. this map shows for each cell num the count of the property processors setted on.
Returns:
true if no errors occurs.

chekcAsSubClass

private boolean chekcAsSubClass(Field field,
                                Column column)
check if the concrete class declared on a column is a subclass of a field.

Parameters:
field - the field
column - the column annotation setted on the field
Returns:
true if the concrete class is a subclass of the field.

checkConcreteClass

private boolean checkConcreteClass(Field field,
                                   Class<?> fieldConcreteClass)
Check if a class is concrete.

Parameters:
field - the field on which the processor works.
fieldConcreteClass - concrete class to use to instanciate the field.
Returns:
true if the class is concrete.

getDefaultValue

private String getDefaultValue(Column column)
Return the default value defined on a column annotation.

Parameters:
column - the column
Returns:
the default value as String.


Copyright © 2014. All Rights Reserved.