javax.management.openmbean

Class TabularType

Implemented Interfaces:
Serializable

public class TabularType
extends OpenType<T>

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<T>

ALLOWED_CLASSNAMES_LIST, String[]ALLOWED_CLASSNAMES

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
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<T>

equals, getClassName, getDescription, getTypeName, hashCode, isArray, isValue, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

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(Object[]) and TabularData.remove(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 Details

equals

public boolean equals(Object obj)
Compares this tabular data type with another object for equality. The objects are judged to be equal if:
  • obj is not null.
  • obj is an instance of TabularType.
  • The type names are equal.
  • The row types are equal.
  • The index names are equal and in the same order.
Overrides:
equals in interface OpenType<T>
Parameters:
obj - the object to compare with.
Returns:
true if the conditions above hold.

getIndexNames

public List 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(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.

Overrides:
hashCode in interface OpenType<T>
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 TabularData with an equivalent type, according to the definition of equals(Object) for TabularType.
Overrides:
isValue in interface OpenType<T>
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.

Overrides:
toString in interface OpenType<T>
Returns:
a @link{java.lang.String} instance representing the instance in textual form.

TabularType.java -- Type descriptor for TabularData instances. 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.