|
Expresso 5-5-0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.dataobjects.DefaultDataField
Default implementation of the DataField interface. This class provides some basic conversion capabilities between different Java types as well as provides all use change logging capabilities.
| Field Summary | |
static String |
ATTRIBUTE_ERROR
Attribute String for if there's an error with the field. |
static String |
ATTRIBUTE_ERROR_MESSAGE
Attribute String for what message to display if there's an error with thie field. |
protected Map |
attributes
A generic map of attribute keys to attribute values |
protected Object |
currentValue
The Current Value |
protected boolean |
isChanged
Flag to signify if the field is changed |
protected boolean |
isValueSet
Flag to signify if the field value has been set - the retrieved value may be null |
protected DataFieldMetaData |
myMetaData
A link to my metadata. |
protected Object |
originalValue
The very first original value... set if the field is changed so we know what's changed |
protected DataObject |
owner
A link to the DataObject that contains me. |
| Constructor Summary | |
protected |
DefaultDataField(DataFieldMetaData metaData,
DataObject parentObject)
Creates a new DefaultDataField object. |
| 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()
Retrieve the field as a InputStream. |
String |
asString()
Retrieves the wrapped object as a String |
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. |
protected String |
getBooleanFieldValue(Boolean theFieldValue)
Internal refactoring for getting what a boolean field should be set to. |
DataFieldMetaData |
getFieldMetaData()
Returns a handle to the Field MetaData object. |
static DefaultDataField |
getInstance(DataFieldMetaData metaData,
DataObject parentObject)
DOCUMENT ME! |
Object |
getOriginalValue()
Retrieve the last original value if the data has changed. |
DataObject |
getOwner()
Returns a handle to the DataObject that is the container for this Data Field |
protected org.apache.oro.text.regex.PatternMatcher |
getPatternMatcher()
Retrieve a thread local instance of the Perl5 pattern matcher. |
Object |
getSerializedForm()
Returns the form in a way suitable for storage in a database or other data source. |
Object |
getValue()
DOCUMENT ME! |
boolean |
isChanged()
Used for change logging and updating only changed fields. change is true IF the field has been set once (after object is born or reset), and subsequently the value is changed in the field. |
boolean |
isNull()
Returns true if the object is null. |
boolean |
isValueSet()
Used for change logging. |
void |
release()
DOCUMENT ME! |
void |
removeAttribute(String attribute)
Removes an attribute |
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 |
setSerializedForm(Object o)
Used for setting raw data from a JDBC connection. |
void |
setValue(Object newValue)
Sets the wrapped object for the data field |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String ATTRIBUTE_ERROR
public static final String ATTRIBUTE_ERROR_MESSAGE
protected transient DataFieldMetaData myMetaData
protected transient DataObject owner
protected Map attributes
protected Object currentValue
protected Object originalValue
protected boolean isChanged
protected boolean isValueSet
| Constructor Detail |
protected DefaultDataField(DataFieldMetaData metaData,
DataObject parentObject)
metaData - DOCUMENT ME!parentObject - DOCUMENT ME!| Method Detail |
public static DefaultDataField getInstance(DataFieldMetaData metaData,
DataObject parentObject)
metaData - DOCUMENT ME!parentObject - DOCUMENT ME!
public Map getAllAttributes()
Map of all attributes in name-value
pairs. If there are no attributes then getAllAttributes will return a
null map.
getAllAttributes in interface DataField
public void setAttribute(String attributeName,
Object value)
setAttribute in interface DataFieldattributeName - the name of the attribute to setvalue - the value to set it topublic Object getAttribute(String attributeName)
getAttribute in interface DataFieldattributeName - the name of the attribute to retrieve
public boolean isChanged()
isChanged in interface DataFieldpublic void setFieldMetaData(DataFieldMetaData newMetadata)
setFieldMetaData in interface DataFieldnewMetadata - the new Field Meta data object... for example
DBFieldpublic DataFieldMetaData getFieldMetaData()
getFieldMetaData in interface DataFieldpublic boolean isNull()
isNull in interface DataFieldpublic Object getOriginalValue()
getOriginalValue in interface DataFieldpublic void setOwner(DataObject newOwner)
setOwner in interface DataFieldnewOwner - The new parent object.public DataObject getOwner()
getOwner in interface DataFieldpublic void setSerializedForm(Object o)
o - the object to set.
public Object getSerializedForm()
throws DataException
DataException - upon errorpublic void setValue(Object newValue)
setValue in interface DataFieldnewValue - a new Object to set the value topublic Object getValue()
getValue in interface DataFieldpublic boolean isValueSet()
isValueSet in interface DataFieldpublic BigDecimal asBigDecimal()
BigDecimal object or zero
if we're unable to convert it.
asBigDecimal in interface DataFieldBigDecimal Object if we're
able to convert it.public Boolean asBoolean()
asBoolean in interface DataFieldpublic Date asDate()
Date object or possibly
null if we can't convert it or the object is null.
asDate in interface DataFieldDate Object if we're able
to convert it.public Double asDouble()
Double object or zero if
we can't convert i
asDouble in interface DataFieldDouble Object if we're able
to convert it.public Integer asInteger()
Integer or zero if it's
an invalid format.
asInteger in interface DataFieldpublic InputStream asStream()
asStream in interface DataFieldpublic String asString()
asString in interface DataField
public void checkValue()
throws DataException
checkValue in interface DataFieldDataException - if the field value is not validpublic void release()
public void removeAttribute(String attribute)
attribute - The attribute key to removepublic void resetChanged()
resetChanged in interface DataFieldprotected String getBooleanFieldValue(Boolean theFieldValue)
theFieldValue - The target value
IllegalArgumentException - If we can't get the data contextprotected org.apache.oro.text.regex.PatternMatcher getPatternMatcher()
|
Expresso 5-5-0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||