|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.fdsapi.arrays.ArrayConverter
Mention either can overwrite data in input array with converted data or copy the output into
another array. By default it allocates a new array and puts the converted data into
a new array of the same size of the input array.
Note calling the convert methods is thread safe IF the various set.../remove... methods are not
called during this operation which can often be the case if the application for example creates
the ArrayConverter class at startup.
setTypeConverter(Object.class, new ConverterNumToString(new ConverterDateToString()));
setTypeConverter(Number.class, new ConverterNumToString());
setTypeConverter(Date.class, new ConverterDateToString());
*
View Code
| Constructor Summary | |
ArrayConverter()
Creates a new instance of ArrayConverter |
|
ArrayConverter(boolean overWriteExistingArray)
Creates a new instance of ArrayConverter and when convert is called if true is passed the array passed into the convert method will be used in place to contain the resulting data, thus saving the the array creation for the output. |
|
ArrayConverter(java.lang.String[] header)
Creates a new instance of ArrayConverter and allows you to use colnames from a header when setting column converters. |
|
ArrayConverter(java.lang.String[] header,
boolean overWriteExistingArray)
Creates an instance that allows for column converters to be set by name, and allows the developer to indicate whether they want the output array to be the original array or not |
|
| Method Summary | |
java.lang.Object |
clone()
Make a clone of the ArrayConverter |
java.lang.Object[][] |
convert(ArrayHeaderLocator arrayHeaderLocator,
java.lang.Object[][] data)
This method 'Converts' the data in the input array. |
java.lang.Object[][] |
convert(java.lang.Object[][] data)
This method 'Converts' the data in the input array. |
java.lang.Object[][] |
convert(java.lang.String[] header,
java.lang.Object[][] data)
This method 'Converts' the data in the input array. |
ArrayConverter |
copy()
Clones the ArrayConverter and then casts it to the appropriate type |
ArrayConverterFactory |
getArrayConverterFactory()
Get the backing ArrayConverterFactory |
static void |
main(java.lang.String[] args)
Method that has test and sample usage code |
boolean |
overWriteExistingArray()
Returns true if an array will not be allocated to hold the converted results, and false otherwise |
void |
removeColConverter(int colNum)
Remove the column converter for the specified column |
void |
removeColConverter(java.lang.String colName)
Remove the column converter for the specified column |
void |
removeTypeConverter(java.lang.Class type)
Remove the Converter for the specified data type |
void |
setArrayConverterFactory(ArrayConverterFactory factory)
Set the factory that will be used to determine which Converters to create |
void |
setArrayHeaderLocator(ArrayHeaderLocator headerLocator)
Specify the ArrayHeaderLocator object that maps column names to column numbers. |
void |
setArrayHeaderLocator(java.lang.String[] header)
Set the ArrayHeaderLocator by passing in an array representing the column names |
void |
setColConverter(int colNum,
Converter converter)
Set the column Converter to be used for a particular column number. |
void |
setColConverter(java.lang.String colName,
Converter converter)
Set the column Converter to be used for a particular column name. |
void |
setDefaultConverter(Converter converter)
Set the default Converter that will be used if no other matches are found |
void |
setOverWriteExistingArray(boolean overWriteExistingArray)
If the contents of the original array are no longer needed then ArrayConverter will not allocate memory and will instead reuse the original data's array. |
void |
setTypeConverter(java.lang.Class type,
Converter converter)
Set the column coverter to be used for the specified datatype. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ArrayConverter()
public ArrayConverter(java.lang.String[] header)
public ArrayConverter(boolean overWriteExistingArray)
public ArrayConverter(java.lang.String[] header,
boolean overWriteExistingArray)
| Method Detail |
public java.lang.Object[][] convert(java.lang.String[] header,
java.lang.Object[][] data)
public java.lang.Object[][] convert(java.lang.Object[][] data)
public java.lang.Object[][] convert(ArrayHeaderLocator arrayHeaderLocator,
java.lang.Object[][] data)
public void setOverWriteExistingArray(boolean overWriteExistingArray)
public boolean overWriteExistingArray()
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 void setArrayConverterFactory(ArrayConverterFactory factory)
public ArrayConverterFactory getArrayConverterFactory()
public java.lang.Object clone()
clone in class java.lang.Objectpublic ArrayConverter copy()
public void setArrayHeaderLocator(ArrayHeaderLocator headerLocator)
public void setArrayHeaderLocator(java.lang.String[] header)
public java.lang.String toString()
toString in class java.lang.Object
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||