com.isti.util
Class IstiNamedValue

java.lang.Object
  extended by com.isti.util.IstiNamedValue
All Implemented Interfaces:
IstiNamedValueInterface
Direct Known Subclasses:
PropItem

public class IstiNamedValue
extends java.lang.Object
implements IstiNamedValueInterface

Class IstiNamedValue defines a named value object.


Field Summary
 
Fields inherited from interface com.isti.util.IstiNamedValueInterface
sepCh
 
Constructor Summary
IstiNamedValue(java.lang.String str)
          Creates a value.
IstiNamedValue(java.lang.String valueName, java.lang.Object defaultValueObj)
          Creates a value.
IstiNamedValue(java.lang.String valueName, java.lang.Object defaultValueObj, java.lang.Object valueObj)
          Creates a value.
 
Method Summary
protected  java.lang.Object checkValue(java.lang.Object valueObj)
          Checks the value object.
 java.lang.Object clone()
          Creates and returns a clone of this object.
protected static java.lang.String determineStringValue(java.lang.Object value)
          Returns a String object representing the value.
 java.lang.Object getDefaultValue()
          Returns the default value object for the value.
 java.lang.String getName()
          Returns the name of the value.
 java.lang.Object getValue()
          Returns the value object for the value.
 boolean isDefaultValue()
          Determines if the current value is the same as the default value.
 boolean setValue(java.lang.Object valueObj)
          Sets the value object for the value.
 boolean setValueString(java.lang.String str)
          Sets the value for the value.
static java.lang.Object setValueString(java.lang.String str, java.lang.Object defValObj)
          Interprets the given string and enters it as the value object for the property item.
 java.lang.String stringValue()
          Returns a String object representing the value.
 java.lang.String toString()
          Returns a String object representing this object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IstiNamedValue

public IstiNamedValue(java.lang.String str)
Creates a value.

Parameters:
str - the string representation for this object.

IstiNamedValue

public IstiNamedValue(java.lang.String valueName,
                      java.lang.Object defaultValueObj)
Creates a value.

Parameters:
valueName - the value name.
defaultValueObj - the default value object.

IstiNamedValue

public IstiNamedValue(java.lang.String valueName,
                      java.lang.Object defaultValueObj,
                      java.lang.Object valueObj)
Creates a value.

Parameters:
valueName - the value name.
defaultValueObj - the default value object.
valueObj - the value object or null for the default.
Method Detail

clone

public java.lang.Object clone()
Creates and returns a clone of this object.

Specified by:
clone in interface IstiNamedValueInterface
Overrides:
clone in class java.lang.Object
Returns:
a clone of the this object.

getDefaultValue

public java.lang.Object getDefaultValue()
Returns the default value object for the value.

Specified by:
getDefaultValue in interface IstiNamedValueInterface
Returns:
the default value object for the value.

getName

public java.lang.String getName()
Returns the name of the value.

Specified by:
getName in interface IstiNamedValueInterface
Returns:
the name of the value.

getValue

public java.lang.Object getValue()
Returns the value object for the value.

Specified by:
getValue in interface IstiNamedValueInterface
Returns:
the value object for the value.

isDefaultValue

public boolean isDefaultValue()
Determines if the current value is the same as the default value.

Specified by:
isDefaultValue in interface IstiNamedValueInterface
Returns:
true if the current value is the same as the default value.

setValue

public boolean setValue(java.lang.Object valueObj)
Sets the value object for the value.

Specified by:
setValue in interface IstiNamedValueInterface
Parameters:
valueObj - the value object.
Returns:
true if successful, false if given object's type does not match the item's default-value object's type.

setValueString

public boolean setValueString(java.lang.String str)
Sets the value for the value. The string is converted to an object of the same type as the given default value object for named value.

Specified by:
setValueString in interface IstiNamedValueInterface
Parameters:
str - the string value to interpret.
Returns:
true if successful, false if the string could not be converted to the proper type.

setValueString

public static java.lang.Object setValueString(java.lang.String str,
                                              java.lang.Object defValObj)
Interprets the given string and enters it as the value object for the property item. The string is converted to an object of the same type as the given default value object for the property item.

Parameters:
str - the string value to interpret.
defValObj - the default value object to use for type checking (this parameter allows for multiple values and types to be dealt with).
Returns:
an Object filled via the given string, or null if the string could not be converted to the proper type.

stringValue

public java.lang.String stringValue()
Returns a String object representing the value.

Specified by:
stringValue in interface IstiNamedValueInterface
Returns:
the String value.

toString

public java.lang.String toString()
Returns a String object representing this object.

Overrides:
toString in class java.lang.Object
Returns:
the String object.

checkValue

protected java.lang.Object checkValue(java.lang.Object valueObj)
Checks the value object.

Parameters:
valueObj - the value object.
Returns:
the value object or null if invalid value.

determineStringValue

protected static java.lang.String determineStringValue(java.lang.Object value)
Returns a String object representing the value.

Parameters:
value - the value.
Returns:
the String value.