org.jlf.dataMap
Class DoubleAttribute

java.lang.Object
  |
  +--org.jlf.dataMap.DataAttribute
        |
        +--org.jlf.dataMap.DoubleAttribute
All Implemented Interfaces:
java.io.Serializable

public class DoubleAttribute
extends DataAttribute

This class is used to hold attributes of type Double. It converts any Number type atribute into a Double, losing precision automatically if called for.

See Also:
DataAttribute, DataAttributeDescriptor, Serialized Form

Field Summary
 
Fields inherited from class org.jlf.dataMap.DataAttribute
hasChanged, name, originalValue, value
 
Constructor Summary
DoubleAttribute()
          Protect the default constructor.
DoubleAttribute(java.lang.String name)
          Normal attribute constructor.
 
Method Summary
 void basicSetValue(java.lang.Number newValue)
          Main setter for Number values to ensure the resulting value set is of type Double.
 void basicSetValue(java.lang.Object newValue)
          Override for Double-specific behavior.
 void basicSetValue(java.lang.String newValue)
          Main setter for String values to ensure the resulting value set is of type Double.
 double getDoubleValue()
          Returns the double value of the attribute if the attribute has one.
 
Methods inherited from class org.jlf.dataMap.DataAttribute
getLongValue, getName, getOriginalValue, getStringValue, getValue, hasChanged, resetAndSetValue, resetHasChanged, setName, setValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleAttribute

public DoubleAttribute()
Protect the default constructor. Must at least have an attribute name to construct the attribute.


DoubleAttribute

public DoubleAttribute(java.lang.String name)
Normal attribute constructor.

Method Detail

basicSetValue

public void basicSetValue(java.lang.Object newValue)
Override for Double-specific behavior.

Overrides:
basicSetValue in class DataAttribute

basicSetValue

public void basicSetValue(java.lang.String newValue)
Main setter for String values to ensure the resulting value set is of type Double.


basicSetValue

public void basicSetValue(java.lang.Number newValue)
Main setter for Number values to ensure the resulting value set is of type Double.


getDoubleValue

public double getDoubleValue()
Returns the double value of the attribute if the attribute has one.

Overrides:
getDoubleValue in class DataAttribute
Throws:
DataMapError - if the attribute cannot be safely converted to a double or if the attribute is null.