bill.util.persist
Class ElementData

java.lang.Object
  |
  +--bill.util.persist.ElementData
Direct Known Subclasses:
BooleanElement, DoubleElement, IntegerElement, LongElement, OIDElement, StringElement

public abstract class ElementData
extends Object

This class is used to define an element and to manipulate its data.


Field Summary
protected  Hashtable _elementData
          Storage place for extra data about an element.
protected  String _logicalName
           
protected  String _physicalName
           
protected  boolean _required
           
protected  Object _value
           
 
Constructor Summary
ElementData()
          Default creator, initializes all the class instance variables.
ElementData(String logicalName, String physicalName)
          Alternate creator, sets class instance variables using the passed parameters and initializes the other instance variables.
 
Method Summary
 Object addElementData(Object key, Object result)
          Adds an entry to the element's collection of associated data.
 boolean equals(Object other)
          Determines if two ElementData objects are equal.
 String formatValue()
          Formats an element's value into a string representation.
 Hashtable getElementData()
          Retrieves the collection of additional data associated with this element.
 String getLogicalName()
          Retrieves the descriptive, logical name of the element.
 String getPhysicalName()
          Retrieves the physical name of the element.
 Object getValue()
          Retrieves the value of the element.
 boolean isRequired()
          Checks if the element is required.
 Object removeElementData(Object key)
          Removes the specified entry from the element's collection of associated data.
 void setElementData(Hashtable elementData)
          Setter for the additional collection of data associated with this element.
 void setLogicalName(String logicalName)
          Sets the descriptive logical name of the element.
 void setPhysicalName(String physicalName)
          Sets the physical name of the element.
 void setRequired(boolean required)
          Sets the required indicator for this element.
 void setValue(Object value)
          Sets the value of this element to the specified value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_logicalName

protected String _logicalName

_physicalName

protected String _physicalName

_value

protected Object _value

_required

protected boolean _required

_elementData

protected Hashtable _elementData
Storage place for extra data about an element. For future use.
Constructor Detail

ElementData

public ElementData()
Default creator, initializes all the class instance variables.

ElementData

public ElementData(String logicalName,
                   String physicalName)
Alternate creator, sets class instance variables using the passed parameters and initializes the other instance variables.
Parameters:
logicalName - Descriptive logical name of the element.
physicalName - Physical name of the element, in the case of an RDBMS this would be the table column name of the element.
Method Detail

setLogicalName

public void setLogicalName(String logicalName)
Sets the descriptive logical name of the element.
Parameters:
logicalName - The descriptive name.

setPhysicalName

public void setPhysicalName(String physicalName)
Sets the physical name of the element. In the case of an RDBMS this would be the table column name.
Parameters:
physicalName - The physical name.

setElementData

public void setElementData(Hashtable elementData)
Setter for the additional collection of data associated with this element.
Parameters:
elementData - The additional collection of data.

setValue

public void setValue(Object value)
              throws PersistException
Sets the value of this element to the specified value.
Parameters:
value - The value to set the element's value to.
Throws:
PersistException - Thrown when the value cannot be properly set.

setRequired

public void setRequired(boolean required)
Sets the required indicator for this element. Required elements must have a value.
Parameters:
required - The value to set the element's required indicator to.

getLogicalName

public String getLogicalName()
Retrieves the descriptive, logical name of the element.
Returns:
The descriptive name.

getPhysicalName

public String getPhysicalName()
Retrieves the physical name of the element. In the case of an RDBMS this would represent the table column name of the element.
Returns:
The physical name.

getElementData

public Hashtable getElementData()
Retrieves the collection of additional data associated with this element.
Returns:
The collection of additional data.

getValue

public Object getValue()
Retrieves the value of the element.
Returns:
The element's value.

isRequired

public boolean isRequired()
Checks if the element is required. Required elements must have a value.
Returns:
Whenther the element is required.

addElementData

public Object addElementData(Object key,
                             Object result)
Adds an entry to the element's collection of associated data.
Parameters:
key - The key to the associated data entry.
result - The value to the associated data entry.
Returns:
Reference to the added result object.

removeElementData

public Object removeElementData(Object key)
Removes the specified entry from the element's collection of associated data.
Parameters:
key - The key to the associated data entry to be removed.
Returns:
The element entry that was removed.

formatValue

public String formatValue()
Formats an element's value into a string representation.
Returns:
The formatted element value.

equals

public boolean equals(Object other)
Determines if two ElementData objects are equal. For the two objects to be equal they must have the same logical name.
Overrides:
equals in class Object
Returns:
If they are equal, returns true, otherwise returns false.

toString

public String toString()
Overrides:
toString in class Object