olg.csv.bean.loader
Class CellProcessorLoader<B>

Package class diagram package CellProcessorLoader
java.lang.Object
  extended by olg.csv.bean.loader.CellProcessorLoader<B>
Type Parameters:
B - the entity type the cellProcessor deals with.
Direct Known Subclasses:
CellProcessorLoader.RowBeanPropertyFormatterLoader

public class CellProcessorLoader<B>
extends Object

Class dedicated to load List of ColumnFormatter from an XML file.

See Also:
CellProcessor

Nested Class Summary
protected static class CellProcessorLoader.RowBeanPropertyFormatterLoader<B>
          PropertyFormatterLoader adaptation in order to manage with beanRowType elements.
 
Field Summary
protected static String ATTR_CLASS
          class attribute name.
protected static String ATTR_NAME
          column name attribute name.
protected static String ATTR_RANG
          rang atribute name.
protected static String EL_COLUMN
          Column node name.
protected static String EL_FILTER
          Filter node name.
protected static String EL_FORMATTER
          Formatter node name.
protected static String EL_PROPERTIES
          Properties node name.
protected static String EL_PROPERTY
          Property node name.
 
Constructor Summary
CellProcessorLoader()
           
 
Method Summary
protected
<E> List<CellProcessor<B>>
extractColumnType(Element element, Class<E> beanClass)
          Identifies from an XML Element a CellProcessor list.
private static PropertyFormatter extractConcateReadPropertyType(Element element, Class<?> beanClass)
          Returns a PropertyFormatter which assembles severals properties of the given bean as a string.
private static PropertyFormatter extractReadPropertyType(Element element, Class<?> classBean)
          Returns PropertyFormatter from the given XML element.
protected
<E> List<CellProcessor<B>>
load(Element element, String xmlListNodeName, Class<E> beanClass)
          load a CellProcessor list from an xml node.
 List<CellProcessor<B>> load(File file)
          Returns the ColumnFormatter list described in the given XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_NAME

protected static final String ATTR_NAME
column name attribute name.

See Also:
Constant Field Values

ATTR_CLASS

protected static final String ATTR_CLASS
class attribute name.

See Also:
Constant Field Values

ATTR_RANG

protected static final String ATTR_RANG
rang atribute name.

See Also:
Constant Field Values

EL_COLUMN

protected static final String EL_COLUMN
Column node name.

See Also:
Constant Field Values

EL_FORMATTER

protected static final String EL_FORMATTER
Formatter node name.

See Also:
Constant Field Values

EL_FILTER

protected static final String EL_FILTER
Filter node name.

See Also:
Constant Field Values

EL_PROPERTY

protected static final String EL_PROPERTY
Property node name.

See Also:
Constant Field Values

EL_PROPERTIES

protected static final String EL_PROPERTIES
Properties node name.

See Also:
Constant Field Values
Constructor Detail

CellProcessorLoader

public CellProcessorLoader()
Method Detail

load

public List<CellProcessor<B>> load(File file)
                            throws LoadException
Returns the ColumnFormatter list described in the given XML file.

XML root of the given file must be one of the followings :

Parameters:
file - the XML File.
Returns:
a new ColumnFormatter list
Throws:
LoadException - if an error occurs during loading
See Also:
CellProcessor

load

protected <E> List<CellProcessor<B>> load(Element element,
                                          String xmlListNodeName,
                                          Class<E> beanClass)
                               throws ClassNotFoundException,
                                      LoadException,
                                      XPathExpressionException
load a CellProcessor list from an xml node.

Type Parameters:
E - the type on which identify the properties target of the cell processors.
Parameters:
element - xml element conformed to XML Schema bean-writerType or beanRowType specification.
xmlListNodeName - node name identifying columnFormatter description as expectected in the XML schema type of the given element
beanClass - the bean class from which identify the properties targeted by the cell processors.. May be the B class or the class of a B property.
Returns:
a new ColumnFormatter list
Throws:
ClassNotFoundException - if class not found when an attribute ("class") is identified as a class
LoadException - if an error occurs during loading
XPathExpressionException - on invalid XPathExpression

extractColumnType

protected <E> List<CellProcessor<B>> extractColumnType(Element element,
                                                       Class<E> beanClass)
                                            throws LoadException,
                                                   XPathExpressionException,
                                                   ClassNotFoundException
Identifies from an XML Element a CellProcessor list.

Type Parameters:
E - the type on which identify the properties target of the cell processors.
Parameters:
element - the XML Element (ColumnType Element)
beanClass - the bean class from which identify the properties targeted by the cell processors. May be the B class or the class of a B property.
Returns:
a list
Throws:
XPathExpressionException - on invalid XPathExpression
LoadException - if an error occurs during loading
XPathExpressionException - on invalid XPathExpression
ClassNotFoundException - if class not found when an attribute ("class") is identified as a class

extractConcateReadPropertyType

private static PropertyFormatter extractConcateReadPropertyType(Element element,
                                                                Class<?> beanClass)
                                                         throws LoadException,
                                                                XPathExpressionException,
                                                                ClassNotFoundException
Returns a PropertyFormatter which assembles severals properties of the given bean as a string.

Parameters:
element - XML node supposed to be conformed to ConcateReadPropertyType xsd declaration
beanClass - class of the bean which has the propeties the propertyFormatter assembles.
Returns:
the property formatter loaded from the XML node.
Throws:
LoadException - if an error occurs during loading
XPathExpressionException - on invalid XPathExpression
ClassNotFoundException - if class not found when an attribute ("class") is identified as a class

extractReadPropertyType

private static PropertyFormatter extractReadPropertyType(Element element,
                                                         Class<?> classBean)
                                                  throws LoadException,
                                                         XPathExpressionException,
                                                         ClassNotFoundException
Returns PropertyFormatter from the given XML element.

Parameters:
element - corresponding to ReadPropertyType xsd declaration
classBean - bean parent class the bean class from which the returned propertyFormatter must format a property as a string
Returns:
the property formatter loaded from the xml node.
Throws:
LoadException - if an error occurs during loading
XPathExpressionException - on invalid XPathExpression
ClassNotFoundException - if class not found when an attribute ("class") is identified as a class


Copyright © 2014. All Rights Reserved.