olg.csv.bean.impl
Class BeanProcessor<B>

Package class diagram package BeanProcessor
java.lang.Object
  extended by olg.csv.bean.impl.BeanProcessor<B>
Type Parameters:
B - dedicated bean the transformer products
All Implemented Interfaces:
IBeanProcessor<B>

public final class BeanProcessor<B>
extends Object
implements IBeanProcessor<B>

In reading process, this class allows to product beans from list of Strings.


Field Summary
private  Class<B> beanClass
          bean class this transformer products.
private  List<IPropertyProcessor<B>> properties
          A BeanProcessor has a list of transformers.
 
Constructor Summary
BeanProcessor(Class<B> beanClass)
           
 
Method Summary
 boolean add(IPropertyProcessor<B> arg0)
          Adds a concret propertyProcessor.
 boolean addAll(Collection<IPropertyProcessor<B>> arg0)
          Adds a propertyProcessor collection.
 B transform(Row line)
          Returns a new bean built from the given row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beanClass

private final Class<B> beanClass
bean class this transformer products.


properties

private final List<IPropertyProcessor<B>> properties
A BeanProcessor has a list of transformers. Each of them converts a string into a property of the bean this processor must return.

Constructor Detail

BeanProcessor

public BeanProcessor(Class<B> beanClass)
Parameters:
beanClass - the class of beans the transformer returns. This class must be conformed to bean class ( has a constructor with no arguments and all its properties must be accessible with public getter and mutable with public setter)
Method Detail

add

public boolean add(IPropertyProcessor<B> arg0)
Adds a concret propertyProcessor.

Parameters:
arg0 - the propertyProcessor to add.
Returns:
true if added.

addAll

public boolean addAll(Collection<IPropertyProcessor<B>> arg0)
Adds a propertyProcessor collection.

Parameters:
arg0 - the collection. Must be not null.
Returns:
true if added

transform

public B transform(Row line)
Returns a new bean built from the given row.

Specified by:
transform in interface IBeanProcessor<B>
Parameters:
line - list of String
Returns:
null if Row Argument is null or this transformer has no property transformer


Copyright © 2014. All Rights Reserved.