javax.management.openmbean

Class TabularType

public class TabularType extends OpenType<TabularData>

The open type descriptor for instances of the {@link TabularData} class.

Since: 1.5

Constructor Summary
TabularType(String name, String desc, CompositeType rowType, String[] indexNames)

Constructs a new {@link TabularType} instance for the given type name, description, row type and index names.

Method Summary
booleanequals(Object obj)

Compares this tabular data type with another object for equality.

List<String>getIndexNames()
Returns an unmodifiable list containing the index names.
CompositeTypegetRowType()
Returns the type of the rows used by this tabular data structure.
inthashCode()

Returns the hash code of the tabular data type.

booleanisValue(Object obj)
Returns true if the specified object is a member of this tabular type.
StringtoString()

Returns a textual representation of this instance.

Constructor Detail

TabularType

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

Constructs a new {@link 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 {@link java.lang.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 {@link 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 {@link TabularData#get(java.lang.Object[])} and {@link TabularData#remove(java.lang.Object[])} methods of the {@link 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:

Parameters: obj the object to compare with.

Returns: true if the conditions above hold.

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 {@link 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 {@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.

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 {@link TabularData} with an equivalent type, according to the definition of {@link #equals(java.lang.Object)} for {@link TabularType}.

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 {@link equals(java.lang.Object)} and {@link 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.

Returns: a @link{java.lang.String} instance representing the instance in textual form.