ArrayType
class is the open type class whose instances describe
all open data values which are n-dimensional arrays of open data values.
Examples of valid ArrayType
instances are:
// 2-dimension array of java.lang.String
ArrayType<String[][]> a1 = new ArrayType<String[][]>(2, SimpleType.STRING);
// 1-dimension array of int
ArrayType<int[]> a2 = new ArrayType<int[]>(SimpleType.INTEGER, true);
// 1-dimension array of java.lang.Integer
ArrayType<Integer[]> a3 = new ArrayType<Integer[]>(SimpleType.INTEGER, false);
// 4-dimension array of int
ArrayType<int[][][][]> a4 = new ArrayType<int[][][][]>(3, a2);
// 4-dimension array of java.lang.Integer
ArrayType<Integer[][][][]> a5 = new ArrayType<Integer[][][][]>(3, a3);
// 1-dimension array of java.lang.String
ArrayType<String[]> a6 = new ArrayType<String[]>(SimpleType.STRING, false);
// 1-dimension array of long
ArrayType<long[]> a7 = new ArrayType<long[]>(SimpleType.LONG, true);
// 1-dimension array of java.lang.Integer
ArrayType<Integer[]> a8 = ArrayType.getArrayType(SimpleType.INTEGER);
// 2-dimension array of java.lang.Integer
ArrayType<Integer[][]> a9 = ArrayType.getArrayType(a8);
// 2-dimension array of int
ArrayType<int[][]> a10 = ArrayType.getPrimitiveArrayType(int[][].class);
// 3-dimension array of int
ArrayType<int[][][]> a11 = ArrayType.getArrayType(a10);
// 1-dimension array of float
ArrayType<float[]> a12 = ArrayType.getPrimitiveArrayType(float[].class);
// 2-dimension array of float
ArrayType<float[][]> a13 = ArrayType.getArrayType(a12);
// 1-dimension array of javax.management.ObjectName
ArrayType<ObjectName[]> a14 = ArrayType.getArrayType(SimpleType.OBJECTNAME);
// 2-dimension array of javax.management.ObjectName
ArrayType<ObjectName[][]> a15 = ArrayType.getArrayType(a14);
// 3-dimension array of java.lang.String
ArrayType<String[][][]> a16 = new ArrayType<String[][][]>(3, SimpleType.STRING);
// 1-dimension array of java.lang.String
ArrayType<String[]> a17 = new ArrayType<String[]>(1, SimpleType.STRING);
// 2-dimension array of java.lang.String
ArrayType<String[][]> a18 = new ArrayType<String[][]>(1, a17);
// 3-dimension array of java.lang.String
ArrayType<String[][][]> a19 = new ArrayType<String[][][]>(1, a18);
Modifier and Type | Field and Description |
---|---|
private int | |
private OpenType | |
private transient Integer | |
private transient String | |
private static final Object[][] | |
private static final int | |
private static final int | |
private static final int | |
private static final int | |
private boolean | |
pack-priv static final long |
Access | Constructor and Description |
---|---|
public | ArrayType(int
the dimension of arrays described by this dimension, OpenType<?> ArrayType instance;
must be greater than or equal to 1.the open type of element values contained
in the arrays described by this elementType)ArrayType
instance; must be an instance of either
SimpleType , CompositeType ,
TabularType or another ArrayType
with a SimpleType , CompositeType
or TabularType as its elementType .Constructs an |
public | ArrayType(SimpleType<?>
the elementType, boolean SimpleType of the element values
contained in the arrays described by this
ArrayType instance.true when this array describes
primitive arrays.Constructs a unidimensional |
pack-priv |
Modifier and Type | Method and Description |
---|---|
private static String | |
private static String | |
private static String | |
private static String | |
private boolean | checkElementsType(Object[] x_dim_Array, int dim)
Returns true if and only if all elements contained in the array argument x_dim_Array of dimension dim are valid values (ie either null or of the right openType) for the element open type specified by this ArrayType instance. |
private <T> ArrayType | |
private <T> ArrayType | |
public boolean | Returns: true if the specified object is equal to
this ArrayType instance.the object to be compared for equality with this
obj)ArrayType instance; if obj
is null or is not an instance of the
class ArrayType this method returns
false .Implements abstract javax. Compares the specified |
public static < the Java type that described instances must have E> ArrayType | Returns: anArrayType instancethe open type of element values contained
in the arrays described by this elementType)ArrayType
instance; must be an instance of either
SimpleType , CompositeType ,
TabularType or another ArrayType
with a SimpleType , CompositeType
or TabularType as its elementType .Create an |
public int | Returns: the dimension.Returns the dimension of arrays described by this |
public OpenType | Returns: the element type.Returns the open type of element values contained
in the arrays described by this |
public static < the Java type that described instances must have T> ArrayType | Returns: anArrayType instancea primitive array class such as arrayClass)int[].class ,
boolean[][].class , etc. The getElementOpenType() method of the returned
ArrayType returns the SimpleType
corresponding to the wrapper type of the primitive
type of the array.Create an |
pack-priv static SimpleType | Returns: the OpenType corresponding to the given primitive type name (SimpleType.BOOLEAN, SimpleType.CHARACTER, etc...) return null if the given elementClassName is not a primitive type name.the primitive type of the array element ("boolean",
"char", etc...) primitiveTypeName)Return the primitive open type corresponding to the given primitive type. |
pack-priv static String | Returns: the key corresponding to the given type ("Z", "C", etc...) return null if the given elementClassName is not a primitive wrapper class name.the wrapper class name of the array
element ("Boolean", "Character", etc...) elementClassName)Return the key used to identify the element type in arrays - e.g. "Z" for boolean, "C" for char etc... |
pack-priv static String | Returns: the primitive type name corresponding to the given wrapper class ("boolean", "char", etc...) return null if the given elementClassName is not a primitive wrapper type name.the type of the array element ("Boolean",
"Character", etc...) elementClassName)Return the primitive type name corresponding to the given wrapper class. |
public int | Returns: the hash code value for thisArrayType instanceImplements abstract javax. Returns the hash code value for this |
pack-priv boolean | isAssignableFrom(OpenType<?>
the type to be tested. ot)Overrides javax. Tests whether values of the given type can be assigned to this open type. |
public boolean | Returns: true if this is a primitive array type.Returns |
pack-priv static boolean | |
public boolean | Returns: true if obj is a value for this
ArrayType instance.the object to be tested. obj)Implements abstract javax. Tests whether obj is a value for this |
private Object | |
public String | Returns: a string representation of thisArrayType instanceImplements abstract javax. Returns a string representation of this |
private Object |
dimension | back to summary |
---|---|
private int dimension |
elementType | back to summary |
---|---|
private OpenType<?> elementType |
myHashCode | back to summary |
---|---|
private transient Integer myHashCode |
myToString | back to summary |
---|---|
private transient String myToString |
PRIMITIVE_ARRAY_TYPES | back to summary |
---|---|
private static final Object[][] PRIMITIVE_ARRAY_TYPES |
PRIMITIVE_OPEN_TYPE_INDEX | back to summary |
---|---|
private static final int PRIMITIVE_OPEN_TYPE_INDEX |
PRIMITIVE_TYPE_KEY_INDEX | back to summary |
---|---|
private static final int PRIMITIVE_TYPE_KEY_INDEX |
PRIMITIVE_TYPE_NAME_INDEX | back to summary |
---|---|
private static final int PRIMITIVE_TYPE_NAME_INDEX |
PRIMITIVE_WRAPPER_NAME_INDEX | back to summary |
---|---|
private static final int PRIMITIVE_WRAPPER_NAME_INDEX |
primitiveArray | back to summary |
---|---|
private boolean primitiveArray
|
serialVersionUID | back to summary |
---|---|
pack-priv static final long serialVersionUID |
ArrayType | back to summary |
---|---|
public ArrayType(int dimension, OpenType<?> elementType) throws OpenDataException Constructs an
When invoked on an
The internal field corresponding to the type name of this
As an example, the following piece of code:
would produce the following output:
And the following piece of code which is equivalent to the one listed
above would also produce the same output:
|
ArrayType | back to summary |
---|---|
public ArrayType(SimpleType<?> elementType, boolean primitiveArray) throws OpenDataException Constructs a unidimensional
This constructor supports the creation of arrays of primitive
types when
For primitive arrays the
When invoked on an
The internal field corresponding to the type name of this
As an example, the following piece of code:
would produce the following output:
|
ArrayType | back to summary |
---|---|
pack-priv ArrayType(String className, String typeName, String description, int dimension, OpenType<?> elementType, boolean primitiveArray) |
buildArrayClassName | back to summary |
---|---|
private static String buildArrayClassName(int dimension, OpenType<?> elementType) throws OpenDataException |
buildArrayClassName | back to summary |
---|---|
private static String buildArrayClassName(int dimension, OpenType<?> elementType, boolean isPrimitiveArray) throws OpenDataException |
buildArrayDescription | back to summary |
---|---|
private static String buildArrayDescription(int dimension, OpenType<?> elementType) throws OpenDataException |
buildArrayDescription | back to summary |
---|---|
private static String buildArrayDescription(int dimension, OpenType<?> elementType, boolean isPrimitiveArray) throws OpenDataException |
checkElementsType | back to summary |
---|---|
private boolean checkElementsType(Object[] x_dim_Array, int dim) Returns true if and only if all elements contained in the array argument x_dim_Array of dimension dim are valid values (ie either null or of the right openType) for the element open type specified by this ArrayType instance. This method's implementation uses recursion to go down the dimensions of the array argument. |
convertFromPrimitiveToWrapperTypes | back to summary |
---|---|
private <T> ArrayType |
convertFromWrapperToPrimitiveTypes | back to summary |
---|---|
private <T> ArrayType |
equals | back to summary |
---|---|
public boolean equals(Object obj) Implements abstract javax. Compares the specified
Two
|
getArrayType | back to summary |
---|---|
public static <E> ArrayType Create an Multidimensional arrays can be built up by calling this method as many times as necessary. Calling this method twice with the same parameters may return the same object or two equal but not identical objects. As an example, the following piece of code:
would produce the following output:
|
getDimension | back to summary |
---|---|
public int getDimension() Returns the dimension of arrays described by this
|
getElementOpenType | back to summary |
---|---|
public OpenType Returns the open type of element values contained
in the arrays described by this
|
getPrimitiveArrayType | back to summary |
---|---|
public static <T> ArrayType Create an Calling this method twice with the same parameters may return the same object or two equal but not identical objects. As an example, the following piece of code:
would produce the following output:
|
getPrimitiveOpenType | back to summary |
---|---|
pack-priv static SimpleType Return the primitive open type corresponding to the given primitive type. e.g. SimpleType.BOOLEAN for "boolean", SimpleType.CHARACTER for "char", etc...
|
getPrimitiveTypeKey | back to summary |
---|---|
pack-priv static String getPrimitiveTypeKey(String elementClassName) Return the key used to identify the element type in arrays - e.g. "Z" for boolean, "C" for char etc... |
getPrimitiveTypeName | back to summary |
---|---|
pack-priv static String getPrimitiveTypeName(String elementClassName) Return the primitive type name corresponding to the given wrapper class. e.g. "boolean" for "Boolean", "char" for "Character" etc... |
hashCode | back to summary |
---|---|
public int hashCode() Implements abstract javax. Returns the hash code value for this
The hash code of an
As
|
isAssignableFrom | back to summary |
---|---|
pack-priv boolean isAssignableFrom(OpenType<?> ot) Overrides javax. Doc from javax. Tests whether values of the given type can be assigned to this open type. The default implementation of this method returns true only if the types are equal. |
isPrimitiveArray | back to summary |
---|---|
public boolean isPrimitiveArray() Returns
|
isPrimitiveContentType | back to summary |
---|---|
pack-priv static boolean isPrimitiveContentType(final String primitiveKey) |
isValue | back to summary |
---|---|
public boolean isValue(Object obj) Implements abstract javax. Tests whether obj is a value for this
This method returns
|
readResolve | back to summary |
---|---|
private Object readResolve() throws ObjectStreamException Replace/resolve the object read from the stream before it is returned to the caller.
|
toString | back to summary |
---|---|
public String toString() Implements abstract javax. Returns a string representation of this
The string representation consists of the name of this class (i.e.
As
|
writeReplace | back to summary |
---|---|
private Object writeReplace() throws ObjectStreamException Nominate a replacement for this object in the stream before the object is written.
|