TabularType (Java SE 26 & JDK 26)
Description: declaration: module: java.management, package: javax.management.openmbean, class: TabularType
Keywords: javax.management.openmbean.TabularType class

# Class TabularType

java.lang.Object
javax.management.openmbean.OpenType<TabularData>
javax.management.openmbean.TabularType

All Implemented Interfaces:
  `Serializable`

public class TabularType extends OpenType<TabularData>
The `TabularType` class is the open type class whose instances describe the types of `TabularData` values.

Since:
  1.5
See Also:
  - Serialized Form

- ## Field Summary

  ### Fields declared in class OpenType

  `ALLOWED_CLASSNAMES, ALLOWED_CLASSNAMES_LIST`
  Modifier and Type
  Field
  Description
  `static final String[]`
  `ALLOWED_CLASSNAMES`
  Deprecated.
  Use `ALLOWED_CLASSNAMES_LIST` instead.
  `static final List<String>`
  `ALLOWED_CLASSNAMES_LIST`
  List of the fully qualified names of the Java classes allowed for open data values.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TabularType(String typeName, String description, CompositeType rowType, String[] indexNames)`
  Constructs a `TabularType` instance, checking for the validity of the given parameters.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  Compares the specified `obj` parameter with this `TabularType` instance for equality.
  `List<String>`
  `getIndexNames()`
  Returns, in the same order as was given to this instance's constructor, an unmodifiable List of the names of the items the values of which are used to uniquely index each row element of tabular data values described by this `TabularType` instance.
  `CompositeType`
  `getRowType()`
  Returns the type of the row elements of tabular data values described by this `TabularType` instance.
  `int`
  `hashCode()`
  Returns the hash code value for this `TabularType` instance.
  `boolean`
  `isValue(Object obj)`
  Tests whether obj is a value which could be described by this `TabularType` instance.
  `String`
  `toString()`
  Returns a string representation of this `TabularType` instance.

  ### Methods declared in class OpenType

  `getClassName, getDescription, getTypeName, isArray`
  Modifier and Type
  Method
  Description
  `String`
  `getClassName()`
  Returns the fully qualified Java class name of the open data values this open type describes.
  `String`
  `getDescription()`
  Returns the text description of this `OpenType` instance.
  `String`
  `getTypeName()`
  Returns the name of this `OpenType` instance.
  `boolean`
  `isArray()`
  Returns `true` if the open data values this open type describes are arrays, `false` otherwise.

  ### Methods declared in class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### TabularType

    public TabularType(String typeName, String description, CompositeType rowType, String[] indexNames) throws OpenDataException
    Constructs a `TabularType` instance, checking for the validity of the given parameters. The validity constraints are described below for each parameter.

    The Java class name of tabular data values this tabular type represents (ie the class name returned by the `getClassName` method) is set to the string value returned by `TabularData.class.getName()`.

    Parameters:
      `typeName` - The name given to the tabular type this instance represents; cannot be a null or empty string.
      `description` - The human readable description of the tabular type this instance represents; cannot be a null or empty string.
      `rowType` - The type of the row elements of tabular data values described by this tabular type instance; cannot be null.
      `indexNames` - The names of the items the values of which are used to uniquely index each row element in the tabular data values described by this tabular type instance; cannot be null or empty. Each element should be an item name defined in rowType (no null or empty string allowed). It is important to note that the order of the item names in indexNames is used by the methods `get` and `remove` of class `TabularData` to match their array of values parameter to items.
    Throws:
      `IllegalArgumentException` - if rowType is null, or indexNames is a null or empty array, or an element in indexNames is a null or empty string, or typeName or description is a null or empty string.
      `OpenDataException` - if an element's value of indexNames is not an item name defined in rowType.

- ## Method Details

  - ### getRowType

    public CompositeType getRowType()
    Returns the type of the row elements of tabular data values described by this `TabularType` instance.
    Returns:
      the type of each row.

  - ### getIndexNames

    public List<String> getIndexNames()

    Returns, in the same order as was given to this instance's constructor, an unmodifiable List of the names of the items the values of which are used to uniquely index each row element of tabular data values described by this `TabularType` instance.

    Returns:
      a List of String representing the names of the index items.

  - ### isValue

    public boolean isValue(Object obj)
    Tests whether obj is a value which could be described by this `TabularType` instance.

    If obj is null or is not an instance of `javax.management.openmbean.TabularData`, `isValue` returns `false`.

    If obj is an instance of `javax.management.openmbean.TabularData`, say `td`, the result is true if this `TabularType` is assignable from `td.getTabularType()`, as defined in `CompositeType.isValue`.

    Specified by:
      `isValue` in class `OpenType<TabularData>`
    Parameters:
      `obj` - the value whose open type is to be tested for compatibility with this `TabularType` instance.
    Returns:
      `true` if obj is a value for this tabular type, `false` otherwise.

  - ### equals

    public boolean equals(Object obj)
    Compares the specified `obj` parameter with this `TabularType` instance for equality.

    Two `TabularType` instances are equal if and only if all of the following statements are true:

    - their type names are equal
    - their row types are equal
    - they use the same index names, in the same order
    Specified by:
      `equals` in class `OpenType<TabularData>`
    Parameters:
      `obj` - the object to be compared for equality with this `TabularType` instance; if obj is `null`, `equals` returns `false`.
    Returns:
      `true` if the specified object is equal to this `TabularType` instance.
    See Also:
      - `Object.hashCode()`
      - `HashMap`

  - ### hashCode

    public int hashCode()
    Returns the hash code value for this `TabularType` instance.

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

    As `TabularType` 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.

    Overrides:
      `hashCode` in class `Object`
    Returns:
      the hash code value for this `TabularType` instance
    See Also:
      - `Object.equals(java.lang.Object)`
      - `System.identityHashCode(Object)`

  - ### toString

    public String toString()
    Returns a string representation of this `TabularType` instance.

    The string representation consists of the name of this class (ie `javax.management.openmbean.TabularType`), the type name for this instance, the row type string representation of this instance, and the index names of this instance.

    As `TabularType` instances are immutable, the string representation for this instance is calculated once, on the first call to `toString`, and then the same value is returned for subsequent calls.

    Specified by:
      `toString` in class `OpenType<TabularData>`
    Returns:
      a string representation of this `TabularType` instance