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.
author: Michael Rimov since: Expresso 5.0
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.
true if the field has changed since the last reset (i.e.
Retrieve the wrapped object as a BigDecimal object or zero if we're unable
to convert it.
a properly instantiated BigDecimal Object if we're able to convert it.
Retrieve the wrapped object as a Date object or possibly null if we
can't convert it or the object is null.
a properly instantiated Date Object if we're able to convert it.
Retrieve the field as a InputStream. If the object's native type is
an input stream, it returns that. If it is a serializable object,
it returns a ByteArrayInputStream that was created using a
ByteArrayOutputStream as well as a ObjectOutputStream.
java.io.InputSTream or null if there was an IO Exception gettingthe value, the value was null, of if the native object is not serializable
reset 'original' value and isChanged flags;
call when add(), retrieve() or update() has occurred, and currentValue of data fields should be considered 'original value' for purposes of determining 'isChanged'
Retrieves any user defined attributes for this field.
Parameters: attributeName - the name of the attribute to retrieve an object or null if the attribute doesn't exist
Internal refactoring for getting what a boolean field should be set to.
Parameters: theFieldValue - The target value the string value throws: IllegalArgumentException - If we can't get the data context
Retrieve a thread local instance of the Perl5 pattern matcher. Allows
for optimization of # of instances of pattern matcher vs
synchronization.
PatternMatcher
Get a SimpleDateFormat object that is cached. Make sure you have
dateConvertFormatMap already locked before calling this function or you'll
have a race condition.
Parameters: pattern - the format pattern to look up an instantiated SimpleDateFormat object. SimpleDateFormat is NOTthreadsafe, so make sure you do your parsing while still in the synchronizedblock. Perhaps in the future a keyed Object pool will be better.
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.
true if the field has changed since the last reset (i.e. since object was constructed or reset)
Sets an attribute for this particular instance of the Data field
Parameters: attributeName - the name of the attribute to set Parameters: value - the value to set it to
Sets the wrapped object for the data field; also updates values for isValueSet and isChanged flags
Parameters: newValue - a new Object to set the value to