|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.xmlbind.ArrayConverter
public class ArrayConverter
Provides helper methods to convert 2D arrays read by JAXB to the Java's more
natural representation of 2D arrays, namely arrays of arrays. For example,
DoubleArray
can be used to read a 2D array in an XML file. It defines
a DoubleArray.getRows()
method returning a list of
DoubleArray.Row instances
representing rows. Each row is defined by a list of values,
and a repeat count. This class defines the
unmarshalArray(DoubleArray)
method converting such an array object
to a more natural double[][] 2D array. It also provides the
marshalArray(double[][])
which does the inverse operation. Other
similar methods are provided for arrays of integers, and arrays of durations.
Nested Class Summary | |
---|---|
protected static interface |
ArrayConverter.RowFactory<T>
Represents a factory object for creating rows when marshalling a 2D array to JAXB object. |
Constructor Summary | |
---|---|
ArrayConverter()
|
Method Summary | ||
---|---|---|
protected static
|
marshalArray(ArrayConverter.RowFactory<T> factory,
T[][] array)
Uses the given row factory to convert the specified Java 2D array into a list intended to be associated with the JAXB representation of a 2D array. |
|
static BooleanArray |
marshalArray(boolean[][] array)
Marshals a Java 2D array of boolean values into an object that can be serialized to XML by JAXB. |
|
static List<Double> |
marshalArray(double[] array)
Converts an array of double-precision values to a list containing values wrapped into objects of class Double . |
|
static DoubleArray |
marshalArray(double[][] array)
Marshals a Java 2D array of double-precision values into an object that can be serialized to XML by JAXB. |
|
static DurationArray |
marshalArray(Duration[][] array)
Marshals a Java 2D array of durations into an object that can be serialized to XML by JAXB. |
|
static IntArray |
marshalArray(int[][] array)
Marshals a Java 2D array of integers into an object that can be serialized to XML by JAXB. |
|
static NonNegativeDurationArray |
marshalArrayNonNegative(Duration[][] array)
Similar to marshalArray(Duration[][]) , for
non-negative durations only. |
|
static boolean[][] |
unmarshalArray(BooleanArray array)
Unmarshals a 2D array JAXB object into a Java 2D array of boolean values. |
|
protected static
|
unmarshalArray(Class<T> componentClass,
List<?> rows)
Converts the list of arrays rows into a Java 2D array. |
|
static double[][] |
unmarshalArray(DoubleArray array)
Unmarshals a 2D array JAXB object into a Java 2D array of double-precision values. |
|
static Duration[][] |
unmarshalArray(DurationArray array)
Unmarshals a 2D array JAXB object into a Java 2D array of time durations. |
|
static int[][] |
unmarshalArray(IntArray array)
Unmarshals a 2D array JAXB object into a Java 2D array of integers. |
|
static double[] |
unmarshalArray(List<Double> list)
Converts a list containing double-precision values wrapped into objects of class Double to an array
of double-precision values. |
|
static Duration[][] |
unmarshalArray(NonNegativeDurationArray array)
Similar to unmarshalArray(DurationArray)
for non-negative durations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayConverter()
Method Detail |
---|
protected static <T> T[][] unmarshalArray(Class<T> componentClass, List<?> rows)
Integer
, and that
getValue returns a List
.
It is assumed that the list returned by getValue
contains instances of the class represented by
componentClass.
This method is intended to be
called by front-end methods
public such as unmarshalArray(DoubleArray)
.
T
- the type of components in the 2D array.componentClass
- the component class of the 2D array.rows
- the list of row elements.
public static double[][] unmarshalArray(DoubleArray array)
array
- the 2D array represented as a JAXB object.
public static boolean[][] unmarshalArray(BooleanArray array)
array
- the 2D array represented as a JAXB object.
public static int[][] unmarshalArray(IntArray array)
array
- the 2D array represented as a JAXB object.
public static Duration[][] unmarshalArray(DurationArray array)
Duration.getTimeInMillis(java.util.Date)
.
array
- the 2D array represented as a JAXB object.
public static Duration[][] unmarshalArray(NonNegativeDurationArray array)
unmarshalArray(DurationArray)
for non-negative durations.
array
- the 2D array represented as a JAXB object.
protected static <T> List<?> marshalArray(ArrayConverter.RowFactory<T> factory, T[][] array)
marshalArray(double[][])
.
T
- the class of the components in the array.factory
- the row factory.array
- the Java 2D array.
public static BooleanArray marshalArray(boolean[][] array)
array
- the input Java 2D array.
public static DoubleArray marshalArray(double[][] array)
array
- the input Java 2D array.
public static IntArray marshalArray(int[][] array)
array
- the input Java 2D array.
public static DurationArray marshalArray(Duration[][] array)
DatatypeFactory
.
array
- the input Java 2D array.
public static NonNegativeDurationArray marshalArrayNonNegative(Duration[][] array)
marshalArray(Duration[][])
, for
non-negative durations only.
array
- the input Java 2D array.
public static double[] unmarshalArray(List<Double> list)
Double
to an array
of double-precision values.
list
- the list of wrapped values.
public static List<Double> marshalArray(double[] array)
Double
.
array
- the array of values.
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |