Fields Summary |
---|
static final long | serialVersionUID |
public static final SimpleType | VOIDThe SimpleType instance describing values whose
Java class name is java.lang.Void . |
public static final SimpleType | BOOLEANThe SimpleType instance describing values whose
Java class name is java.lang.Boolean . |
public static final SimpleType | CHARACTERThe SimpleType instance describing values whose
Java class name is java.lang.Character . |
public static final SimpleType | BYTEThe SimpleType instance describing values whose
Java class name is java.lang.Byte . |
public static final SimpleType | SHORTThe SimpleType instance describing values whose
Java class name is java.lang.Short . |
public static final SimpleType | INTEGERThe SimpleType instance describing values whose
Java class name is java.lang.Integer . |
public static final SimpleType | LONGThe SimpleType instance describing values whose
Java class name is java.lang.Long . |
public static final SimpleType | FLOATThe SimpleType instance describing values whose
Java class name is java.lang.Float . |
public static final SimpleType | DOUBLEThe SimpleType instance describing values whose
Java class name is java.lang.Double . |
public static final SimpleType | STRINGThe SimpleType instance describing values whose
Java class name is java.lang.String . |
public static final SimpleType | BIGDECIMALThe SimpleType instance describing values whose
Java class name is java.math.BigDecimal . |
public static final SimpleType | BIGINTEGERThe SimpleType instance describing values whose
Java class name is java.math.BigInteger . |
public static final SimpleType | DATEThe SimpleType instance describing values whose
Java class name is java.util.Date . |
public static final SimpleType | OBJECTNAMEThe SimpleType instance describing values whose
Java class name is javax.management.ObjectName . |
private static final SimpleType[] | typeArray |
private transient Integer | myHashCode |
private transient String | myToString |
private static final Map | canonicalTypes |
Methods Summary |
---|
public boolean | equals(java.lang.Object obj)Compares the specified obj parameter with this SimpleType instance for equality.
Two SimpleType instances are equal if and only if their
{@link OpenType#getClassName() getClassName} methods return the same value.
/* If it weren't for readReplace(), we could replace this method
with just:
return (this == obj);
*/
if (!(obj instanceof SimpleType))
return false;
SimpleType other = (SimpleType) obj;
// Test if other's className field is the same as for this instance
//
return this.getClassName().equals(other.getClassName());
|
public int | hashCode()Returns the hash code value for this SimpleType instance.
The hash code of a SimpleType instance is the the hash code of
the string value returned by the {@link OpenType#getClassName() getClassName} method.
As SimpleType 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.
// Calculate the hash code value if it has not yet been done (ie 1st call to hashCode())
//
if (myHashCode == null) {
myHashCode = new Integer(this.getClassName().hashCode());
}
// return always the same hash code for this instance (immutable)
//
return myHashCode.intValue();
|
public boolean | isValue(java.lang.Object obj)Tests whether obj is a value for this
SimpleType 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 this SimpleType instance (ie the class
name returned by the {@link OpenType#getClassName()
getClassName} method).
// if obj is null, return false
//
if (obj == null) {
return false;
}
// Test if obj's class name is the same as for this instance
//
return this.getClassName().equals(obj.getClass().getName());
|
public java.lang.Object | readResolve()Replace an object read from an {@link
java.io.ObjectInputStream} with the unique instance for that
value.
for (int i = 0; i < typeArray.length; i++) {
final SimpleType type = typeArray[i];
canonicalTypes.put(type, type);
}
final SimpleType canonical = (SimpleType) canonicalTypes.get(this);
if (canonical == null) {
// Should not happen
throw new InvalidObjectException("Invalid SimpleType: " + this);
}
return canonical;
|
public java.lang.String | toString()Returns a string representation of this SimpleType 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 this SimpleType instance represents).
As SimpleType 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.
// Calculate the string representation if it has not yet been done (ie 1st call to toString())
//
if (myToString == null) {
myToString = this.getClass().getName()+ "(name="+ getTypeName() +")";
}
// return always the same string representation for this instance (immutable)
//
return myToString;
|