rdr.core
Class Value

java.lang.Object
  extended by rdr.core.Value
All Implemented Interfaces:
java.io.Serializable

public class Value
extends java.lang.Object
implements java.io.Serializable

Value object. Defines a particular value. Is basically just a value type and a value. Includes methods to convert the Object value into a useful Java type.

Author:
Ivan Bindoff
See Also:
Serialized Form

Constructor Summary
Value(Type type, java.lang.Object value)
          Constructor.
Value(Type type, java.lang.String value)
          Constructor.
 
Method Summary
 java.lang.Object convertString(java.lang.String str)
          Converts a string into a value of the correct type - if possible
 boolean equals(Value v)
           
 java.lang.Object getActualValue()
          Get the actual value of a value, as in, if it's an NUMERIC return an float, if it's a NOMINAL return a string etc.
 Type getType()
           
 java.lang.Object getValue()
          get the value object
 void setType(int valueType)
          set the type
 void setValue(java.lang.Object value)
          set the value object
 java.lang.String toString()
          Convert the Value to readable text.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Value

public Value(Type type,
             java.lang.Object value)
Constructor.

Parameters:
type - the type
value - the actual value object

Value

public Value(Type type,
             java.lang.String value)
Constructor.

Parameters:
type - the type
value - the value as a string
Method Detail

getType

public Type getType()
Returns:
the type object

setType

public void setType(int valueType)
set the type

Parameters:
valueType - a type code to set

getValue

public java.lang.Object getValue()
get the value object

Returns:
value object

setValue

public void setValue(java.lang.Object value)
set the value object

Parameters:
value - the value

toString

public java.lang.String toString()
Convert the Value to readable text.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(Value v)
Parameters:
v - the value to compare this against
Returns:
true if the value v is equivalent to this value, false otherwise.

getActualValue

public java.lang.Object getActualValue()
Get the actual value of a value, as in, if it's an NUMERIC return an float, if it's a NOMINAL return a string etc. *

Returns:
actual value

convertString

public java.lang.Object convertString(java.lang.String str)
Converts a string into a value of the correct type - if possible

Parameters:
str - the string to convert
Returns:
Object the object resulting from conversion, or the original string as an object if not able to convert