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

java.lang.Object
  extended by olg.csv.bean.impl.CellProcessor<B>
Type Parameters:
B - the entity type
All Implemented Interfaces:
Comparable<CellProcessor<B>>, ICellProcessor<B>

public final class CellProcessor<B>
extends Object
implements Comparable<CellProcessor<B>>, ICellProcessor<B>

This class allows to format a column cell from entity properties values.

Author:
Olivier Godineau

Constructor Summary
CellProcessor(String rang, String name, PropertyFormatter propertyFormatter)
           
 
Method Summary
 int compareTo(CellProcessor<B> columnFormatter)
           Comparison is based on the rang field.
 boolean equals(Object obj)
           
 Cell getHeader()
          Provides a header cell.
 String getName()
          Get the column header name.
 PropertyFormatter getPropertyFormatter()
          Returns the formatter dedicated to rendering the entity properties as value of column cell.
 int getRang()
          Returns the column num.
 int hashCode()
           
 void setName(String name)
          Set the column header name.
 void setPropertyFormatter(PropertyFormatter propertyFormatter)
          Sets the formatter dedicated to format entity properties as cell value.
 void setRang(int rang)
          Sets the column num.
 Cell transform(B e)
          Product a cell from a bean.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellProcessor

public CellProcessor(String rang,
                     String name,
                     PropertyFormatter propertyFormatter)
Parameters:
rang - column number
name - column header name
propertyFormatter - the formatter to rendering the entity properties as value of column cell
Method Detail

getRang

public int getRang()
Returns the column num. Column num begin at 0.

Returns:
the columne num.

getName

public String getName()
Get the column header name.

Returns:
the column header name.

getPropertyFormatter

public PropertyFormatter getPropertyFormatter()
Returns the formatter dedicated to rendering the entity properties as value of column cell.

Returns:
the formatter.

setRang

public void setRang(int rang)
Sets the column num.

Parameters:
rang - the column num.

setName

public void setName(String name)
Set the column header name.

Parameters:
name - the header.

setPropertyFormatter

public void setPropertyFormatter(PropertyFormatter propertyFormatter)
Sets the formatter dedicated to format entity properties as cell value.

Parameters:
propertyFormatter - the formatter.

compareTo

public int compareTo(CellProcessor<B> columnFormatter)
Comparison is based on the rang field.

Specified by:
compareTo in interface Comparable<CellProcessor<B>>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

transform

public Cell transform(B e)
Product a cell from a bean. Typically, a cell contains a string representation of a field of the given bean.

Specified by:
transform in interface ICellProcessor<B>
Parameters:
e - the bean.
Returns:
the cell.

getHeader

public Cell getHeader()
Provides a header cell.

Specified by:
getHeader in interface ICellProcessor<B>
Returns:
the header cell.


Copyright © 2014. All rights reserved.