Class SimpleType<T>
- java.lang.Object
-
- javax.management.openmbean.OpenType<T>
-
- javax.management.openmbean.SimpleType<T>
-
- All Implemented Interfaces:
- Serializable
public final class SimpleType<T> extends OpenType<T>
TheSimpleType
class is the open type class whose instances describe all open data values which are neither arrays, norCompositeData
values, norTabularData
values. It predefines all its possible instances as static fields, and has no public constructor.Given a
SimpleType
instance describing values whose Java class name is className, the internal fields corresponding to the name and description of thisSimpleType
instance are also set to className. In other words, its methodsgetClassName
,getTypeName
andgetDescription
all return the same string value className.- Since:
- 1.5
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static SimpleType<BigDecimal>
BIGDECIMAL
TheSimpleType
instance describing values whose Java class name isjava.math.BigDecimal
.static SimpleType<BigInteger>
BIGINTEGER
TheSimpleType
instance describing values whose Java class name isjava.math.BigInteger
.static SimpleType<Boolean>
BOOLEAN
TheSimpleType
instance describing values whose Java class name isjava.lang.Boolean
.static SimpleType<Byte>
BYTE
TheSimpleType
instance describing values whose Java class name isjava.lang.Byte
.static SimpleType<Character>
CHARACTER
TheSimpleType
instance describing values whose Java class name isjava.lang.Character
.static SimpleType<Date>
DATE
TheSimpleType
instance describing values whose Java class name isjava.util.Date
.static SimpleType<Double>
DOUBLE
TheSimpleType
instance describing values whose Java class name isjava.lang.Double
.static SimpleType<Float>
FLOAT
TheSimpleType
instance describing values whose Java class name isjava.lang.Float
.static SimpleType<Integer>
INTEGER
TheSimpleType
instance describing values whose Java class name isjava.lang.Integer
.static SimpleType<Long>
LONG
TheSimpleType
instance describing values whose Java class name isjava.lang.Long
.static SimpleType<ObjectName>
OBJECTNAME
TheSimpleType
instance describing values whose Java class name isjavax.management.ObjectName
.static SimpleType<Short>
SHORT
TheSimpleType
instance describing values whose Java class name isjava.lang.Short
.static SimpleType<String>
STRING
TheSimpleType
instance describing values whose Java class name isjava.lang.String
.static SimpleType<Void>
VOID
TheSimpleType
instance describing values whose Java class name isjava.lang.Void
.-
Fields inherited from class javax.management.openmbean.OpenType
ALLOWED_CLASSNAMES, ALLOWED_CLASSNAMES_LIST
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
equals(Object obj)
Compares the specifiedobj
parameter with thisSimpleType
instance for equality.int
hashCode()
Returns the hash code value for thisSimpleType
instance.boolean
isValue(Object obj)
Tests whether obj is a value for thisSimpleType
instance.Object
readResolve()
Replace an object read from anObjectInputStream
with the unique instance for that value.String
toString()
Returns a string representation of thisSimpleType
instance.-
Methods inherited from class javax.management.openmbean.OpenType
getClassName, getDescription, getTypeName, isArray
-
-
-
-
Field Detail
VOID
public static final SimpleType<Void> VOID
TheSimpleType
instance describing values whose Java class name isjava.lang.Void
.
BOOLEAN
public static final SimpleType<Boolean> BOOLEAN
TheSimpleType
instance describing values whose Java class name isjava.lang.Boolean
.
CHARACTER
public static final SimpleType<Character> CHARACTER
TheSimpleType
instance describing values whose Java class name isjava.lang.Character
.
BYTE
public static final SimpleType<Byte> BYTE
TheSimpleType
instance describing values whose Java class name isjava.lang.Byte
.
SHORT
public static final SimpleType<Short> SHORT
TheSimpleType
instance describing values whose Java class name isjava.lang.Short
.
INTEGER
public static final SimpleType<Integer> INTEGER
TheSimpleType
instance describing values whose Java class name isjava.lang.Integer
.
LONG
public static final SimpleType<Long> LONG
TheSimpleType
instance describing values whose Java class name isjava.lang.Long
.
FLOAT
public static final SimpleType<Float> FLOAT
TheSimpleType
instance describing values whose Java class name isjava.lang.Float
.
DOUBLE
public static final SimpleType<Double> DOUBLE
TheSimpleType
instance describing values whose Java class name isjava.lang.Double
.
STRING
public static final SimpleType<String> STRING
TheSimpleType
instance describing values whose Java class name isjava.lang.String
.
BIGDECIMAL
public static final SimpleType<BigDecimal> BIGDECIMAL
TheSimpleType
instance describing values whose Java class name isjava.math.BigDecimal
.
BIGINTEGER
public static final SimpleType<BigInteger> BIGINTEGER
TheSimpleType
instance describing values whose Java class name isjava.math.BigInteger
.
DATE
public static final SimpleType<Date> DATE
TheSimpleType
instance describing values whose Java class name isjava.util.Date
.
OBJECTNAME
public static final SimpleType<ObjectName> OBJECTNAME
TheSimpleType
instance describing values whose Java class name isjavax.management.ObjectName
.
-
Method Detail
isValue
public boolean isValue(Object obj)
Tests whether obj is a value for thisSimpleType
instance.This method returns
true
if and only if obj is not null and obj's class name is the same as the className field defined for thisSimpleType
instance (ie the class name returned by thegetClassName
method).
equals
public boolean equals(Object obj)
Compares the specifiedobj
parameter with thisSimpleType
instance for equality.Two
SimpleType
instances are equal if and only if theirgetClassName
methods return the same value.- Specified by:
-
equals
in classOpenType<T>
- Parameters:
-
obj
- the object to be compared for equality with thisSimpleType
instance; if obj isnull
or is not an instance of the classSimpleType
,equals
returnsfalse
. - Returns:
-
true
if the specified object is equal to thisSimpleType
instance. - See Also:
-
Object.hashCode()
,HashMap
hashCode
public int hashCode()
Returns the hash code value for thisSimpleType
instance. The hash code of aSimpleType
instance is the the hash code of the string value returned by thegetClassName
method.As
SimpleType
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<T>
- Returns:
-
the hash code value for this
SimpleType
instance - See Also:
-
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
toString
public String toString()
Returns a string representation of thisSimpleType
instance.The string representation consists of the name of this class (ie
javax.management.openmbean.SimpleType
) and the type name for this instance (which is the java class name of the values thisSimpleType
instance represents).As
SimpleType
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.
readResolve
public Object readResolve() throws ObjectStreamException
Replace an object read from anObjectInputStream
with the unique instance for that value.- Returns:
- the replacement object.
- Throws:
-
ObjectStreamException
- if the read object cannot be resolved.
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.