javax.management.openmbean
public class ArrayType extends OpenType
Since: 1.5
Constructor Summary | |
---|---|
ArrayType(int dim, OpenType elementType) Constructs a new {@link ArrayType} instance for an array of the specified type with the supplied number of dimensions. |
Method Summary | |
---|---|
boolean | equals(Object obj) Compares this array type with another object for equality. |
int | getDimension()
Returns the number of dimensions used by arrays
of this type.
|
OpenType | getElementOpenType()
Returns the open type descriptor which describes
the type of the elements of this array type.
|
int | hashCode() Returns the hash code of the array type. |
boolean | isValue(Object obj) Returns true if the specified object is a member of this array type. |
String | toString() Returns a textual representation of this instance. |
Constructs a new {@link ArrayType} instance for an array of the
specified type with the supplied number of dimensions. The attributes
used by the superclass, {@link OpenType}, are automatically defined,
based on these values. Both the class name and type name are set
to the value returned by the {@link java.lang.Class#getName()} of
the array's class (i.e. the element type, preceded by n instances of
'[' and an 'L', where n is the number of dimensions the array has).
The description is based upon the template n-dimension array
of e
, where n is the number of dimensions of the array, and
e is the element type. The class name of the actual elements is
obtainable by calling {@link OpenType#getClassName()} on the result
of {@link #getElementOpenType()}.
As an example, the array type returned by
new ArrayType(6, SimpleType.INTEGER)
has the following
values:
Attribute | Value |
Class Name | [[[[[[Ljava.lang.Integer;
|
Type Name | [[[[[[Ljava.lang.Integer;
|
Description | 6-dimension array of
java.lang.Integer |
Element Type Class Name | java.lang.Integer
|
The dimensions of the array must be equal to or greater than 1. The element type must be an instance of {@link SimpleType}, {@link CompositeType} or {@link TabularType}.
Parameters: dim the dimensions of the array. elementType the type of the elements of the array.
Throws: IllegalArgumentException if dim
is less than 1. OpenDataException if the element type is not an instance of either
{@link SimpleType}, {@link CompositeType}
or {@link TabularType}.
Compares this array type with another object for equality. The objects are judged to be equal if:
obj
is not null.obj
is an instance of
{@link ArrayType}.Parameters: obj the object to compare with.
Returns: true if the conditions above hold.
Returns: the number of dimensions.
Returns: the type of the elements.
Returns the hash code of the array type. This is computed as the sum of the hash code of the element type together with the number of dimensions the array has. These are the same elements of the type that are compared as part of the {@link #equals(java.lang.Object)} method, thus ensuring that the hashcode is compatible with the equality test.
As instances of this class are immutable, the hash code is computed just once for each instance and reused throughout its life.
Returns: the hash code of this instance.
Returns true if the specified object is a member of this array type. The object is judged to be so if it is non-null, an array and one of the following two conditions holds:
Parameters: obj the object to test for membership.
Returns: true if the object is a member of this type.
Returns a textual representation of this instance. This
is constructed using the class name
(javax.management.openmbean.ArrayType
)
and each element of the instance which is relevant to
the definition of {@link equals(java.lang.Object)} and
{@link hashCode()} (i.e. the type name, the number of
dimensions and the element type).
As instances of this class are immutable, the return value is computed just once for each instance and reused throughout its life.
Returns: a @link{java.lang.String} instance representing the instance in textual form.