- java.lang.Object
-
- javax.management.openmbean.OpenType<CompositeData>
-
- javax.management.openmbean.CompositeType
-
- All Implemented Interfaces:
- Serializable
public class CompositeType extends OpenType<CompositeData>
TheCompositeType
class is the open type class whose instances describe the types of
values.CompositeData
- Since:
- 1.5
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.management.openmbean.OpenType
ALLOWED_CLASSNAMES, ALLOWED_CLASSNAMES_LIST
-
-
Constructor Summary
Constructors Constructor and Description CompositeType(String typeName, String description, String[] itemNames, String[] itemDescriptions, OpenType<?>[] itemTypes)
Constructs aCompositeType
instance, checking for the validity of the given parameters.
-
Method Summary
Methods Modifier and Type Method and Description boolean
containsKey(String itemName)
Returnstrue
if thisCompositeType
instance defines an item whose name is itemName.boolean
equals(Object obj)
Compares the specifiedobj
parameter with thisCompositeType
instance for equality.String
getDescription(String itemName)
Returns the description of the item whose name is itemName, ornull
if thisCompositeType
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, ornull
if thisCompositeType
instance does not define any item whose name is itemName.int
hashCode()
Returns the hash code value for thisCompositeType
instance.boolean
isValue(Object obj)
Tests whether obj is a value which could be described by thisCompositeType
instance.Set<String>
keySet()
Returns an unmodifiable Set view of all the item names defined by thisCompositeType
instance.String
toString()
Returns a string representation of thisCompositeType
instance.-
Methods inherited from class javax.management.openmbean.OpenType
getClassName, getDescription, getTypeName, isArray
-
-
-
-
Constructor Detail
-
CompositeType
public CompositeType(String typeName, String description, String[] itemNames, String[] itemDescriptions, OpenType<?>[] itemTypes) throws OpenDataException
Constructs aCompositeType
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
getClassName
method) is set to the string value returned byCompositeData.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 thisCompositeType
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 aCompositeType
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 thisCompositeType
instance; should be of the same size as itemNames; no element can be null or an empty string.
itemTypes
- The open type instances, in the same order as itemNames, describing the items contained in the composite data values described by thisCompositeType
instance; should be of the same size as itemNames; no element can be null.
- Throws:
IllegalArgumentException
- If typeName or description is a null or empty string, or itemNames or itemDescriptions or itemTypes is null, or any element of itemNames or itemDescriptions is a null or empty string, or any element of itemTypes is null, or itemNames or itemDescriptions or itemTypes are not of the same size.
OpenDataException
- If itemNames contains duplicate item names (case sensitive, but leading and trailing whitespaces removed).
-
-
Method Detail
-
containsKey
public boolean containsKey(String itemName)
Returnstrue
if thisCompositeType
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.
-
getDescription
public String getDescription(String itemName)
Returns the description of the item whose name is itemName, ornull
if thisCompositeType
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, ornull
if thisCompositeType
instance does not define any item whose name is itemName.- Parameters:
itemName
- the name of the time.- Returns:
- the type.
-
keySet
public Set<String> keySet()
Returns an unmodifiable Set view of all the item names defined by thisCompositeType
instance. The set's iterator will return the item names in ascending order.
-
isValue
public boolean isValue(Object obj)
Tests whether obj is a value which could be described by thisCompositeType
instance.If obj is null or is not an instance of
javax.management.openmbean.CompositeData
,isValue
returnsfalse
.If obj is an instance of
javax.management.openmbean.CompositeData
, then letct
be itsCompositeType
as returned byCompositeData.getCompositeType()
. The result is true ifthis
is assignable fromct
. This means that:this.getTypeName()
equalsct.getTypeName()
, and- there are no item names present in
this
that are not also present inct
, and - for every item in
this
, its type is assignable from the type of the corresponding item inct
.
A
TabularType
is assignable from anotherTabularType
if they have the same typeName and index name list, and the row type of the first is assignable from the row type of the second.An
ArrayType
is assignable from anotherArrayType
if they have the same dimension; and both are primitive arrays or neither is; and the element type of the first is assignable from the element type of the second.In every other case, an
OpenType
is assignable from anotherOpenType
only if they are equal.These rules mean that extra items can be added to a
CompositeData
without making it invalid for aCompositeType
that does not have those items.- Specified by:
isValue
in classOpenType<CompositeData>
- Parameters:
obj
- the value whose open type is to be tested for compatibility with thisCompositeType
instance.- Returns:
true
if obj is a value for this composite type,false
otherwise.
-
equals
public boolean equals(Object obj)
Compares the specifiedobj
parameter with thisCompositeType
instance for equality.Two
CompositeType
instances are equal if and only if all of the following statements are true:- their type names are equal
- their items' names and types are equal
- Specified by:
equals
in classOpenType<CompositeData>
- Parameters:
obj
- the object to be compared for equality with thisCompositeType
instance; if obj isnull
,equals
returnsfalse
.- Returns:
true
if the specified object is equal to thisCompositeType
instance.- See Also:
Object.hashCode()
,HashMap
-
hashCode
public int hashCode()
Returns the hash code value for thisCompositeType
instance.The hash code of a
CompositeType
instance is the sum of the hash codes of all elements of information used inequals
comparisons (ie: name, items names, items types). This ensures thatt1.equals(t2)
implies thatt1.hashCode()==t2.hashCode()
for any twoCompositeType
instancest1
andt2
, as required by the general contract of the methodObject.hashCode()
.As
CompositeType
instances are immutable, the hash code for this instance is calculated once, on the first call tohashCode
, and then the same value is returned for subsequent calls.- Specified by:
hashCode
in classOpenType<CompositeData>
- Returns:
- the hash code value for this
CompositeType
instance - See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
toString
public String toString()
Returns a string representation of thisCompositeType
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 totoString
, and then the same value is returned for subsequent calls.- Specified by:
toString
in classOpenType<CompositeData>
- Returns:
- a string representation of this
CompositeType
instance
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/11/2024 21:33:06 Cette version de la page est en cache (à la date du 21/11/2024 21:33:06) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 01/09/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/management/openmbean/compositetype.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.