This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.management.openmbean
class CompositeType

java.lang.Object extended by javax.management.openmbean.OpenType extended by javax.management.openmbean.CompositeType
All Implemented Interfaces:
Serializable

public class CompositeType
extends OpenType

The CompositeType class is the open type class whose instances describe the types of {@link CompositeData CompositeData} values.


Field Summary
 
Fields inherited from class javax.management.openmbean.OpenType
ALLOWED_CLASSNAMES, ALLOWED_CLASSNAMES_LIST
 
Constructor Summary
CompositeType(String typeName, String description, String[] itemNames, String[] itemDescriptions, OpenType[] itemTypes)

          Constructs a CompositeType instance, checking for the validity of the given parameters.
 
Method Summary
 boolean
containsKey(String itemName)

          Returns true if this CompositeType instance defines an item whose name is itemName.
 boolean

          Compares the specified obj parameter with this CompositeType instance for equality.
 String

          Returns the description of the item whose name is itemName, or null if this CompositeType instance does not define any item whose name is itemName.
 OpenType
getType(String itemName)

          Returns the open type of the item whose name is itemName, or null if this CompositeType instance does not define any item whose name is itemName.
 int

          Returns the hash code value for this CompositeType instance.
 boolean

          Tests whether obj is a value which could be described by this CompositeType instance.
 Set

          Returns an unmodifiable Set view of all the item names defined by this CompositeType instance.
 String

          Returns a string representation of this CompositeType instance.
 
Methods inherited from class javax.management.openmbean.OpenType
equals, getClassName, getDescription, getTypeName, hashCode, isArray, isValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeType

public CompositeType(String typeName,
                     String description,
                     String[] itemNames,
                     String[] itemDescriptions,
                     OpenType[] itemTypes)
              throws OpenDataException
Constructs a CompositeType instance, checking for the validity of the given parameters. The validity constraints are described below for each parameter.

Note that the contents of the three array parameters itemNames, itemDescriptions and itemTypes are internally copied so that any subsequent modification of these arrays by the caller of this constructor has no impact on the constructed CompositeType instance.

The Java class name of composite data values this composite type represents (ie the class name returned by the {@link OpenType#getClassName() getClassName} method) is set to the string value returned by CompositeData.class.getName().

Parameters:
typeName - The name given to the composite type this instance represents; cannot be a null or empty string.
 
description - The human readable description of the composite type this instance represents; cannot be a null or empty string.
 
itemNames - The names of the items contained in the composite data values described by this CompositeType instance; cannot be null and should contain at least one element; no element can be a null or empty string. Note that the order in which the item names are given is not important to differentiate a CompositeType instance from another; the item names are internally stored sorted in ascending alphanumeric order.
 
itemDescriptions - The descriptions, in the same order as itemNames, of the items contained in the composite data values described by this CompositeType instance; should be of the same size as itemNames; no element can be a null or empty string.
 
itemTypes - The open type instances, in the same order as itemNames, describing the items contained in the composite data values described by this CompositeType instance; should be of the same size as itemNames; no element can be null.
 
Throws:
OpenDataException - If itemNames contains duplicate item names (case sensitive, but leading and trailing whitespaces removed).
Method Detail

containsKey

public boolean containsKey(String itemName)
Returns true if this CompositeType instance defines an item whose name is itemName.

Parameters:
itemName - the name of the item.
Returns:
true if an item of this name is present.

equals

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

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


 

Overrides:
equals in class OpenType
Parameters:
obj - the object to be compared for equality with this CompositeType instance; if obj is null, equals returns false.
Returns:
true if the specified object is equal to this CompositeType instance.

getDescription

public String getDescription(String itemName)
Returns the description of the item whose name is itemName, or null if this CompositeType instance does not define any item whose name is itemName.

Parameters:
itemName - the name of the item.
Returns:
the description.

getType

public OpenType getType(String itemName)
Returns the open type of the item whose name is itemName, or null if this CompositeType instance does not define any item whose name is itemName.

Parameters:
itemName - the name of the time.
Returns:
the type.

hashCode

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

The hash code of a CompositeType instance is the sum of the hash codes of all elements of information used in equals comparisons (ie: name, items names, items types). This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode() for any two CompositeType instances t1 and t2, as required by the general contract of the method {@link Object#hashCode() Object.hashCode()}.

As CompositeType 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 OpenType
Returns:
the hash code value for this CompositeType instance

isValue

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

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

If obj is an instance of javax.management.openmbean.CompositeData, then let {@code ct} be its {@code CompositeType} as returned by {@link CompositeData#getCompositeType()}. The result is true if {@code this} is assignable from {@code ct}. This means that:

A {@code TabularType} is assignable from another {@code TabularType} if they have the same {@linkplain TabularType#getTypeName() typeName} and {@linkplain TabularType#getIndexNames() index name list}, and the {@linkplain TabularType#getRowType() row type} of the first is assignable from the row type of the second.

An {@code ArrayType} is assignable from another {@code ArrayType} if they have the same {@linkplain ArrayType#getDimension() dimension}; and both are {@linkplain ArrayType#isPrimitiveArray() primitive arrays} or neither is; and the {@linkplain ArrayType#getElementOpenType() element type} of the first is assignable from the element type of the second.

In every other case, an {@code OpenType} is assignable from another {@code OpenType} only if they are equal.

These rules mean that extra items can be added to a {@code CompositeData} without making it invalid for a {@code CompositeType} that does not have those items.

Overrides:
isValue in class OpenType
Parameters:
obj - the value whose open type is to be tested for compatibility with this CompositeType instance.
Returns:
true if obj is a value for this composite type, false otherwise.

keySet

public Set keySet()
Returns an unmodifiable Set view of all the item names defined by this CompositeType instance. The set's iterator will return the item names in ascending order.

Returns:
a {@link Set} of {@link String}.

toString

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

The string representation consists of the name of this class (ie javax.management.openmbean.CompositeType), the type name for this instance, and the list of the items names and types string representation of this instance.

As CompositeType 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.

Overrides:
toString in class OpenType
Returns:
a string representation of this CompositeType instance


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.