Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.management.openmbean
Class ArrayType

    java.lang.Object
      |
      +--javax.management.openmbean.OpenType
            |
            +--javax.management.openmbean.ArrayType

All Implemented Interfaces:
  java.io.Serializable

public class ArrayType
extends OpenType
implements java.io.Serializable

The `ArrayType` class is the open type class whose instances describe all open data values which are n-dimensional arrays of open data values.

Author:
  Young Yang
See Also:
  Serialized Form

Field Summary

Fields inherited from class javax.management.openmbean.OpenType
`ALLOWED_CLASSNAMES, BIGDECIMAL_CLASSNAME, BIGINTEGER_CLASSNAME, BOOLEAN_CLASSNAME, BYTE_CLASSNAME, CHARACTER_CLASSNAME, COMPOSITEDATA_CLASSNAME, DATE_CLASSNAME, DOUBLE_CLASSNAME, FLOAT_CLASSNAME, INTEGER_CLASSNAME, LONG_CLASSNAME, OBJECTNAME_CLASSNAME, SHORT_CLASSNAME, STRING_CLASSNAME, TABULARDATA_CLASSNAME, VOID_CLASSNAME`

Constructor Summary
`ArrayType(int dimension, OpenType elementType)` Constructs an `ArrayType` instance describing open data values which are arrays with dimension dimension of elements whose open type is elementType.

Method Summary
`boolean` | `equals(java.lang.Object obj)` Compares the specified `obj` parameter with this `ArrayType` instance for equality.
`int` | `getDimension()` Returns the dimension of arrays described by this `ArrayType` instance.
`OpenType` | `getElementOpenType()` Returns the open type of element values contained in the arrays described by this `ArrayType` instance.
`int` | `hashCode()` Returns the hash code value for this `ArrayType` instance.
`boolean` | `isValue(java.lang.Object obj)` Tests whether obj is a value for this `ArrayType` instance.
`static void` | `main(java.lang.String[] args)`
`java.lang.String` | `toString()` Returns a string representation of this open type instance.

Methods inherited from class javax.management.openmbean.OpenType
`getClassName, getDescription, getTypeName, isArray`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ArrayType

    public ArrayType(int dimension,
                     OpenType elementType)
              throws OpenDataException

  Constructs an `ArrayType` instance describing open data values which are arrays with dimension dimension of elements whose open type is elementType.

  When invoked on an `ArrayType` instance, the `getClassName` method returns the class name of the array instances it describes (following the rules defined by the `getName` method of `java.lang.Class`), not the class name of the array elements (which is returned by a call to `getElementOpenType().getClassName()`).

  The internal field corresponding to the type name of this `ArrayType` instance is also set to the class name of the array instances it describes. In other words, the methods `getClassName` and `getTypeName` return the same string value. The internal field corresponding to the description of this `ArrayType` instance is set to a string value which follows the following template:
  `<dimension>-dimension array of <element_class_name>`

  As an example, the following piece of code:

       ArrayType t = new ArrayType(3, SimpleType.STRING);
       System.out.println("array class name       = "+ t.getClassName());
       System.out.println("element class name     = "+ t.getElementOpenType().getClassName());
       System.out.println("array type name        = "+ t.getTypeName());
       System.out.println("array type description = "+ t.getDescription());

  would produce the following output:

       array class name       = [[[java.lang.String;
       element class name     = java.lang.String
       array type name        = [[[java.lang.String;
       array type description = 3-dimension array of java.lang.String

Parameters:
  `dimension` - the dimension of arrays described by this `ArrayType` instance; must be greater than or equal to 1.
  `elementType` - the open type of element values contained in the arrays described by this `ArrayType` instance; must be an instance of either `SimpleType`, `CompositeType` or `TabularType`.
Throws:
  `java.lang.IllegalArgumentException` - if dimension is not a positive integer
  `OpenDataException` - if elementType is an instance of `ArrayType`

Method Detail

### getDimension

    public int getDimension()

  Returns the dimension of arrays described by this `ArrayType` instance.

  Returns:
    the dimension.

### getElementOpenType

    public OpenType getElementOpenType()

  Returns the open type of element values contained in the arrays described by this `ArrayType` instance.

  Returns:
    the element type.

### isValue

    public boolean isValue(java.lang.Object obj)

  Tests whether obj is a value for this `ArrayType` instance.

  This method returns `true` if and only if obj is not null, obj is an array and any one of the following is `true`:

  - if this `ArrayType` instance describes an array of `SimpleType` elements, obj's class name is the same as the className field defined for this `ArrayType` instance (ie the class name returned by the `getClassName` method, which includes the dimension information),
  - if this `ArrayType` instance describes an array of classes implementing the TabularData interface or the CompositeData interface, obj is assignable to such a declared array, and each element contained in obj is either null or a valid value for the element's open type specified by this `ArrayType` instance.

  Specified by:
    `isValue` in class `OpenType`
  Parameters:
    `obj` - the object to be tested.
  Returns:
    `true` if obj is a value for this `ArrayType` instance.

### equals

    public boolean equals(java.lang.Object obj)

  Compares the specified `obj` parameter with this `ArrayType` instance for equality.

  Two `ArrayType` instances are equal if and only if they describes array instances which have the same dimension and elements' open type.

  Specified by:
    `equals` in class `OpenType`
  Parameters:
    `obj` - the object to be compared for equality with this `ArrayType` instance; if obj is `null` or is not an instance of the class `ArrayType`, `equals` returns `false`.
  Returns:
    `true` if the specified object is equal to this `ArrayType` instance.

### hashCode

    public int hashCode()

  Returns the hash code value for this `ArrayType` instance.

  The hash code of a `ArrayType` instance is the sum of the hash codes of all elements of information used in `equals` comparisons (ie: dimension and elements' type). This ensures that `t1.equals(t2)` implies that `t1.hashCode()==t2.hashCode()` for any two `ArrayType` instances `t1` and `t2`, as required by the general contract of the method `Object.hashCode` .

  As `ArrayType` instances are immutable, the hash code for this instance is calculated once, on the first call to `hashCode`, and then the same value is returned for subsequent calls.

  Specified by:
    `hashCode` in class `OpenType`
  Returns:
    the hash code value for this `ArrayType` instance

### toString

    public java.lang.String toString()

  Description copied from class: `OpenType`
  Returns a string representation of this open type instance.

  Specified by:
    `toString` in class `OpenType`
  Returns:
    the string representation.

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD