Expresso 5-6

com.jcorporate.expresso.core.dataobjects
Interface DataField

All Known Implementing Classes:
DefaultDataField, JoinedDataField

public interface DataField

This class represents a single field of data that is stored within the data object. It will provide basic manipulations such as it's original value, and attribute holdings.

Since:
Expresso 5.0.1
Author:
Michael Rimov

Method Summary
 BigDecimal asBigDecimal()
          Retrieve the wrapped object as a BigDecimal object or zero if we're unable to convert it.
 Boolean asBoolean()
          Retrieve the boolean object value.
 Date asDate()
          Retrieve the wrapped object as a Date object or possibly null if we can't convert it or the object is null.
 Double asDouble()
          Retrieve the wrapped object as a Double object or zero if we can't convert i
 Integer asInteger()
          Retrieves the wrapped object as an Integer or zero if it's an invalid format.
 InputStream asStream()
          Allows for retrieval of BLOB database types.
 String asString()
          Retrieves the wrapped object as a String
 void cacheIsChangedComparison()
          call after add() or update().
 void checkValue()
          Make sure the value of the field is valid.
 Map getAllAttributes()
          Returns a Read Only Map of all attributes in name-value pairs.
 Object getAttribute(String attributeName)
          Retrieves any user defined attributes for this field.
 DataFieldMetaData getFieldMetaData()
          Returns a handle to the Field MetaData object.
 Object getOriginalValue()
          Deprecated. 8/04 v.5.5 do not expose this cache Retrieve the last original value if the data has changed. Will return null if isChanged() is false
 DataObject getOwner()
          Returns a handle to the DataObject that is the container for this Data Field
 Object getValue()
          Retrieves the wrapped object for the Data Field
 boolean isChanged()
          Used for change logging.
 boolean isNull()
          Returns true if the object is null.
 boolean isValueSet()
          Used for change logging.
 void resetChanged()
          Resets the changed flag and sets the original value field to null
 void setAttribute(String attributeName, Object value)
          Sets an attribute for this particular instance of the Data field
 void setFieldMetaData(DataFieldMetaData newMetadata)
          Sets the metadata object for this field.
 void setOwner(DataObject newOwner)
          Sets the owner of a given DataObject
 void setValue(Object newValue)
          Sets the wrapped object for the data field
 

Method Detail

getValue

public Object getValue()
Retrieves the wrapped object for the Data Field

Returns:
java.lang.Object or null

asString

public String asString()
Retrieves the wrapped object as a String

Returns:
java.lang.String

asBoolean

public Boolean asBoolean()
Retrieve the boolean object value.

Returns:
java.lang.Boolean

asInteger

public Integer asInteger()
Retrieves the wrapped object as an Integer or zero if it's an invalid format.

Returns:
a java.lang.Integer object, or null if the object is null.

asDate

public Date asDate()
Retrieve the wrapped object as a Date object or possibly null if we can't convert it or the object is null.

Returns:
a properly instantiated Date Object if we're able to convert it.

asBigDecimal

public BigDecimal asBigDecimal()
Retrieve the wrapped object as a BigDecimal object or zero if we're unable to convert it.

Returns:
a properly instantiated BigDecimal Object if we're able to convert it.

asDouble

public Double asDouble()
Retrieve the wrapped object as a Double object or zero if we can't convert i

Returns:
a properly instantiated Double Object if we're able to convert it.

getOriginalValue

public Object getOriginalValue()
Deprecated. 8/04 v.5.5 do not expose this cache Retrieve the last original value if the data has changed. Will return null if isChanged() is false

Returns:
the original object or null

asStream

public InputStream asStream()
Allows for retrieval of BLOB database types.

Returns:
java.io.InputStream

isChanged

public boolean isChanged()
Used for change logging.

Returns:
true if the field has changed since the last reset

isValueSet

public boolean isValueSet()
Used for change logging.

Returns:
true if the field has been set since the last reset

checkValue

public void checkValue()
                throws DataException
Make sure the value of the field is valid.

Throws:
DataException - if the field value is not valid

resetChanged

public void resetChanged()
Resets the changed flag and sets the original value field to null


setValue

public void setValue(Object newValue)
Sets the wrapped object for the data field

Parameters:
newValue - a new Object to set the value to

isNull

public boolean isNull()
Returns true if the object is null.

Returns:
true if the object is null

setAttribute

public void setAttribute(String attributeName,
                         Object value)
Sets an attribute for this particular instance of the Data field

Parameters:
attributeName - the name of the attribute to set
value - the value to set it to

getAttribute

public Object getAttribute(String attributeName)
Retrieves any user defined attributes for this field.

Parameters:
attributeName - the name of the attribute to retrieve
Returns:
an object or null if the attribute doesn't exist

getAllAttributes

public Map getAllAttributes()
Returns a Read Only Map of all attributes in name-value pairs. If there are no attributes then getAllAttributes will return a null map.

Returns:
java.util.map

getOwner

public DataObject getOwner()
Returns a handle to the DataObject that is the container for this Data Field

Returns:
DataObject the containing data object.

setOwner

public void setOwner(DataObject newOwner)
Sets the owner of a given DataObject

Parameters:
newOwner - The new parent object.

getFieldMetaData

public DataFieldMetaData getFieldMetaData()
Returns a handle to the Field MetaData object.

Returns:
DataFieldMetaData

setFieldMetaData

public void setFieldMetaData(DataFieldMetaData newMetadata)
Sets the metadata object for this field.

Parameters:
newMetadata - the new Field Meta data object... for example DBField

cacheIsChangedComparison

public void cacheIsChangedComparison()
call after add() or update(). The currentValue of data fields should be considered the baseline, the 'original value' for purposes of determining 'isChanged'


Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.