|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.fdsapi.arrays.ArrayConverterFactory
This class returns an array of Converter objects to be used in Converting an array based on the
rules speicied below.
This class is not thread safe, however if the factory elements are set at say application
startup then it can be used in a thread safe manner.
When looking up which Converter to use for each column in the array the following
precedence order is used:
1) If a Converter was registered for the column. This can done by either column number or column
name. In the case where both a column number and column name Converter were specified (a tie)
the last one that was registered will be used.
2) If a Converter was registered for the column data type then use that Converter. The first cell
within the column is used to get the data type. If the value is a null then there is no type. The most
specific data type is matched first and then the inheritance chain is walked to find a match. If there
is still no match then the interface tree is walked looking for a match. If there is still no match then
an attempt is made to match Object.class. If there is no matches then proceed to the next step.
3) If there have been no matches to this point then the overall default Converter is used.
View Code
| Constructor Summary | |
ArrayConverterFactory()
default constructor |
|
| Method Summary | |
java.lang.Object |
clone()
Clone this factory |
ArrayConverterFactory |
copy()
Clones this factory and returns it as the factory type. |
Converter[] |
getConverters(ArrayHeaderLocator colNameLocator,
java.lang.Object[][] data)
This method returns an array of Converter objects. |
static java.lang.Class[] |
getTypes(java.lang.Object obj)
This method returns an array of the classes and interfaces that the passed in Object extends or implements. |
static void |
main(java.lang.String[] args)
Test and sample usage code |
void |
removeColConverter(int colNum)
Remove the column Converter associated with the column number. |
void |
removeColConverter(java.lang.String colName)
Remove the column Converter associated with the column name |
void |
removeTypeConverter(java.lang.Class type)
Remove the Converter associated with the data type |
void |
setColConverter(int colNum,
Converter converter)
Set the column Converter by number. |
void |
setColConverter(java.lang.String colName,
Converter converter)
Set the column Converter by name. |
void |
setDefaultConverter(Converter converter)
Set the Converter to be used if no other matches occur based on column, or data type |
void |
setTypeConverter(java.lang.Class type,
Converter converter)
Set the column Converter by data type. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ArrayConverterFactory()
| Method Detail |
public void setDefaultConverter(Converter converter)
public void setColConverter(int colNum,
Converter converter)
public void removeColConverter(int colNum)
public void setColConverter(java.lang.String colName,
Converter converter)
public void removeColConverter(java.lang.String colName)
public void setTypeConverter(java.lang.Class type,
Converter converter)
public void removeTypeConverter(java.lang.Class type)
public Converter[] getConverters(ArrayHeaderLocator colNameLocator,
java.lang.Object[][] data)
public static java.lang.Class[] getTypes(java.lang.Object obj)
public java.lang.Object clone()
clone in class java.lang.Objectpublic ArrayConverterFactory copy()
public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||