ca.quine.jcommons.sourceexporter
Class ArrayConverterFactory
java.lang.Object
|
+--ca.quine.factorygen.Registrar
|
+--ca.quine.jcommons.sourceexporter.ArrayConverterFactory
- public class ArrayConverterFactory
- extends Registrar
Provides a way to get the appropriate
ArrayConverter
to convert
a primitive array into an array holding the same data
where each element is converted into its boxed type.
In Java 1.4, primitive arrays cannot simply be cast to the boxed type,
so an explicit conversion is necessary.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ArrayConverterFactory
protected ArrayConverterFactory()
getInstance
public static ArrayConverterFactory getInstance()
getRegistrant
public IArrayConverter getRegistrant(Object key)
convertToObjectArray
public Object[] convertToObjectArray(Object object,
Class arrayClass,
int dim)
throws ClassNotFoundException
- Called to convert a primitive array into an Object array with the
appropriate wrapped type.
- Parameters:
object
- an array of some primitive typearrayClass
- the primitive type of the array (boolean.class,
int.class, etc.)dim
- the number of dimensions of the array (the
dimension of int[3] is 1, the dimension of
int[3][4] is 2, etc.)
- Returns:
- an Object array with the appropriate wrapped type for the
primitive type of the array of
object
.
ClassNotFoundException