public abstract class NamedInteger extends java.lang.Number implements DataObject, Immutable
public static T fromValue(int value)
public static T[] namedValues()
public static int MIN_VALUE
public static int MAX_VALUE
Modifier | Constructor and Description |
---|---|
protected |
NamedInteger(long value)
Constructs an integer without an associated name.
|
protected |
NamedInteger(long value,
java.lang.String description)
Constructs an integer with an associated name.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue()
Returns the value of this number as a byte.
|
java.lang.Object |
clone()
Perform a deep copy of this object.
|
double |
doubleValue()
Returns the value of this number as a double.
|
boolean |
equals(java.lang.Object obj)
Compares some other object to this one for equality by value (not reference).
|
float |
floatValue()
Returns the value of this number as a float.
|
int |
hashCode()
Gets a hash code value for this object.
|
int |
intValue()
Returns the value of this number as an int.
|
boolean |
isReadOnly()
Check if this object has been set read-only.
|
long |
longValue()
Returns the value of this number as a long.
|
void |
setReadOnly()
Set this object to be "read-only".
|
short |
shortValue()
Returns the value of this number as a short.
|
java.lang.String |
toString()
Returns either the name of this number if it has a name,
or a string formed from the decimal digits of the number.
|
protected NamedInteger(long value, java.lang.String description)
value
- integerdescription
- nameprotected NamedInteger(long value)
value
- integerpublic java.lang.Object clone()
DataObject
Inherently immutable objects may optionally return the same object without modification from clone(), rather than constructing a new instance.
clone
in interface DataObject
clone
in class java.lang.Object
public void setReadOnly()
DataObject
Note that a read-only object is not necessarily immutable; if reference types are returned from accessors, then callers could theoretically mutate those objects even if the top-level object is marked as read-only. The ability to make objects read-only is intended to catch programming errors (e.g. attempting to modify a data object passed as part of a SLEE event), not to provide an absolute guarantee of immutability.
Calling setReadOnly() on an object that is already read-only is a no-op.
Some DataObject implementations may be inherently immutable. In those cases, they are considered always read-only.
setReadOnly
in interface DataObject
public boolean isReadOnly()
DataObject
isReadOnly
in interface DataObject
DataObject.setReadOnly()
public byte byteValue()
byteValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public short shortValue()
shortValue
in class java.lang.Number
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- other objectobj
public int hashCode()
hashCode
in class java.lang.Object