|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.freehep.util.Value
A class that can represent any Java object or primitive. Unlike the built-in primitive proxies (Double, Integer etc) it is mutable. It is used to allow values to be used without needing overloaded methods for each primitive type, and without the overhead of object creation/deletion. When a value is returned by an Object method it should be assumed to be valid only until the next method call to that Object. The use of Value should be avoided in multi-threaded environments.
Field Summary | |
static Class |
TYPE_BOOLEAN
|
static Class |
TYPE_BYTE
|
static Class |
TYPE_CHAR
|
static Class |
TYPE_DATE
|
static Class |
TYPE_DOUBLE
|
static Class |
TYPE_FLOAT
|
static Class |
TYPE_INTEGER
|
static Class |
TYPE_LONG
|
static Class |
TYPE_SHORT
|
static Class |
TYPE_STRING
|
Constructor Summary | |
Value()
|
|
Value(Value v)
|
Method Summary | |
Value |
fromExternal(String external)
Set to value from the external respresentation |
boolean |
getBoolean()
Get the boolean value. |
byte |
getByte()
Get the byte value. |
char |
getChar()
Get the char value. |
Date |
getDate()
Get the Date value. |
double |
getDouble()
Get the double value. |
float |
getFloat()
Get the float value. |
int |
getInt()
Get the integer value. |
long |
getLong()
Get the long value. |
Object |
getObject()
Get the Object value. |
short |
getShort()
Get the short value. |
String |
getString()
Get the String value. |
Class |
getType()
Get the Value's type |
Value |
set(boolean val)
Set the Value's internal value to a boolean. |
Value |
set(byte val)
Set the Value's internal value to a byte. |
Value |
set(char val)
Set the Value's internal value to a char. |
Value |
set(Date val)
Set the Value's internal value to a Date. |
Value |
set(double val)
Set the Value's internal value to a double. |
Value |
set(float val)
Set the Value's internal value to a float. |
Value |
set(int val)
Set the Value's internal value to an integer. |
Value |
set(long val)
Set the Value's internal value to a long. |
Value |
set(Object val)
Set the Value's internal value to an Object. |
Value |
set(short val)
Set the Value's internal value to a short. |
Value |
set(String val)
Set the Value's internal value to a String. |
String |
toExternal()
Returns an external representation of this value |
String |
toString()
Get the String value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Class TYPE_INTEGER
public static final Class TYPE_SHORT
public static final Class TYPE_LONG
public static final Class TYPE_FLOAT
public static final Class TYPE_DOUBLE
public static final Class TYPE_BOOLEAN
public static final Class TYPE_BYTE
public static final Class TYPE_CHAR
public static final Class TYPE_STRING
public static final Class TYPE_DATE
Constructor Detail |
public Value()
public Value(Value v)
Method Detail |
public Class getType()
public Value set(int val)
val
- The integer value.
public Value set(short val)
val
- The short value.
public Value set(long val)
val
- The long value.
public Value set(float val)
val
- The float value.
public Value set(double val)
val
- The double value.
public Value set(boolean val)
val
- The boolean value.
public Value set(byte val)
val
- The byte value.
public Value set(char val)
val
- The char value.
public Value set(String val)
val
- The String value.
public Value set(Date val)
val
- The Date value.
public Value set(Object val)
val
- The Object value.
public int getInt()
A
- ClassCastException is thrown if this Value has incompatible type.public short getShort()
A
- ClassCastException is thrown if this Value has incompatible type.public long getLong()
A
- ClassCastException is thrown if this Value has incompatible type.public float getFloat()
A
- ClassCastException is thrown if this Value has incompatible type.public double getDouble()
A
- ClassCastException is thrown if this Value has incompatible type.public boolean getBoolean()
A
- ClassCastException is thrown if this Value has incompatible type.public byte getByte()
A
- ClassCastException is thrown if this Value has incompatible type.public char getChar()
A
- ClassCastException is thrown if this Value has incompatible type.public String getString()
public Date getDate()
A
- ClassCastException is thrown if this Value has incompatible type.public Object getObject()
public String toString()
public String toExternal()
public Value fromExternal(String external) throws IllegalArgumentException
IllegalArgumentException
|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |