javax.management.openmbean
Class TabularType

java.lang.Object
  extended by javax.management.openmbean.OpenType<TabularData>
      extended by javax.management.openmbean.TabularType
All Implemented Interfaces:
Serializable

public class TabularType
extends OpenType<TabularData>

The open type descriptor for instances of the TabularData class.

Since:
1.5
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.management.openmbean.OpenType
ALLOWED_CLASSNAMES, ALLOWED_CLASSNAMES_LIST
 
Constructor Summary
TabularType(String name, String desc, CompositeType rowType, String[] indexNames)
           Constructs a new TabularType instance for the given type name, description, row type and index names.
 
Method Summary
 boolean equals(Object obj)
           Compares this tabular data type with another object for equality.
 List<String> getIndexNames()
          Returns an unmodifiable list containing the index names.
 CompositeType getRowType()
          Returns the type of the rows used by this tabular data structure.
 int hashCode()
           Returns the hash code of the tabular data type.
 boolean isValue(Object obj)
          Returns true if the specified object is a member of this tabular type.
 String toString()
           Returns a textual representation of this 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

TabularType

public TabularType(String name,
                   String desc,
                   CompositeType rowType,
                   String[] indexNames)
            throws OpenDataException

Constructs a new TabularType instance for the given type name, description, row type and index names. All parameters (including the individual elements of the array of index names) must be non-null and those that are of type String must be non-empty. The array of index names must also be non-empty.

The result of TabularData.class.getName() is adopted as the class name (see OpenType). The ordering of the array elements is relevant in determining the indicies of the values in the table, and thus in the use of the TabularData.get(java.lang.Object[]) and TabularData.remove(java.lang.Object[]) methods of the TabularData class.

Parameters:
name - the name of this tabular type.
desc - a description of this tabular type.
rowType - the type of the rows of the table.
indexNames - the names used to index the rows within the table.
Throws:
IllegalArgumentException - if any validity constraint listed above is broken.
OpenDataException - if an index name does not match a corresponding name in the given row type.
Method Detail

equals

public boolean equals(Object obj)

Compares this tabular data type with another object for equality. The objects are judged to be equal if:

Specified by:
equals in class OpenType<TabularData>
Parameters:
obj - the object to compare with.
Returns:
true if the conditions above hold.
See Also:
Object.hashCode()

getIndexNames

public List<String> getIndexNames()
Returns an unmodifiable list containing the index names. The ordering of these names is used to determine the indicies of the CompositeData values, and is retained from that used in the call to this object's constructor.

Returns:
an unmodifiable list of the index names used by this tabular data structure.

getRowType

public CompositeType getRowType()
Returns the type of the rows used by this tabular data structure.

Returns:
the row type.

hashCode

public int hashCode()

Returns the hash code of the tabular data type. This is computed as the sum of the hash codes of the index names together with the hash code of the type name and row type. These are the same elements of the type that are compared as part of the 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.

Specified by:
hashCode in class OpenType<TabularData>
Returns:
the hash code of this instance.
See Also:
Object.equals(Object), System.identityHashCode(Object)

isValue

public boolean isValue(Object obj)
Returns true if the specified object is a member of this tabular type. The object is judged to be so if it is an instance of TabularData with an equivalent type, according to the definition of equals(java.lang.Object) for TabularType.

Specified by:
isValue in class OpenType<TabularData>
Parameters:
obj - the object to test for membership.
Returns:
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.TabularType) 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 row type and the index names).

As instances of this class are immutable, the return value is computed just once for each instance and reused throughout its life.

Specified by:
toString in class OpenType<TabularData>
Returns:
a @link{java.lang.String} instance representing the instance in textual form.
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)