javax.management.openmbean
Class ArrayType<T>
- Serializable
The open type descriptor for arrays of open data values.
ArrayType(SimpleType> elementType, boolean primitiveArray) -
Constructs a new
ArrayType instance for a unidimensional
array of the specified SimpleType .
|
ArrayType(int dim, OpenType> elementType) -
Constructs a new
ArrayType instance for an array of the
specified type with the supplied number of dimensions.
|
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 | isPrimitiveArray() - Returns true if this instance represents an array of
a primitive 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.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
ArrayType
public ArrayType(SimpleType> elementType,
boolean primitiveArray)
throws OpenDataException
Constructs a new
ArrayType
instance for a unidimensional
array of the specified
SimpleType
. The attributes
used by the superclass,
OpenType
, are automatically defined,
based on these values. Both the class name and type name are set
to the value returned by the
Class.getName()
of
the array's class. If the array is of a primitive type (indicated
by giving
primitiveArray
the value
true
), the
name will be '[' followed by the appropriate letter for the
primitive type (see
Class.getName()
). If the
array is not of a primitive type, then the name is formed from
the element type, preceded by '[' and an 'L', in the same way
as when the multi-dimensional constructor is used.
The description is based upon the template
1-dimension array
of e
, where e is either the primitive type or a class name,
depending on whether the array itself is of a primitive type or not.
The class name of the actual elements is obtainable by calling
OpenType.getClassName()
on the result of
getElementOpenType()
. This will be the appropriate wrapper
class for a primitive type.
As an example, the array type returned by
new ArrayType(SimpleType.INTEGER, true)
has the following
values:
| Attribute | Value | Class Name | [I
|
Type Name | [I
|
Description | 1-dimension array of int |
Element Type Class Name | java.lang.Integer
|
elementType
- the type of the elements of the array.primitiveArray
- true if the array should be of a primitive type.
ArrayType
public ArrayType(int dim,
OpenType> elementType)
throws OpenDataException
Constructs a new
ArrayType
instance for an array of the
specified type with the supplied number of dimensions. The attributes
used by the superclass,
OpenType
, are automatically defined,
based on these values. Both the class name and type name are set
to the value returned by the
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
OpenType.getClassName()
on the result
of
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
SimpleType
,
CompositeType
or
TabularType
.
dim
- the dimensions of the array.elementType
- the type of the elements of the array.
equals
public boolean equals(Object obj)
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
ArrayType
.- The dimensions are equal.
- The element types are equal.
- The primitive array flag is set the same in both
instances.
- equals in interface OpenType<T>
obj
- the object to compare with.
- true if the conditions above hold.
getDimension
public int getDimension()
Returns the number of dimensions used by arrays
of this type.
- the number of dimensions.
getElementOpenType
public OpenType> getElementOpenType()
Returns the open type descriptor which describes
the type of the elements of this array type.
- the type of the elements.
hashCode
public int hashCode()
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 and the primitive array flag. These
are the same elements of the type that are compared as
part of the
equals(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.
- hashCode in interface OpenType<T>
- the hash code of this instance.
isPrimitiveArray
public boolean isPrimitiveArray()
Returns true if this instance represents an array of
a primitive type.
- true if the array is of a primitive type.
isValue
public boolean isValue(Object obj)
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:
- isValue in interface OpenType<T>
obj
- the object to test for membership.
- true if the object is a member of this type.
toString
public String toString()
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
equals(java.lang.Object)
and
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.
- toString in interface OpenType<T>
- a @link{java.lang.String} instance representing
the instance in textual form.
ArrayType.java -- Open type descriptor for an array.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.