java.lang.Object
nectar.record.datatypes.RecordDataElement
- All Implemented Interfaces:
- IRecordDataElement, java.io.Serializable
- Direct Known Subclasses:
- RecordAuthlevelEnum, RecordAvailabilityEnum, RecordBoolean, RecordCountryEnum, RecordCreditCardTypeEnum, RecordCurrencyEnum, RecordDate, RecordDecimal, RecordEmail, RecordForumPermissionEnum, RecordImageFormatEnum, RecordInteger, RecordIntegerString, RecordLanguageEnum, RecordPaymentTypeEnum, RecordPersonPrefContactMeEnum, RecordPhone, RecordProcessingStatusEnum, RecordStatusEnum, RecordString, RecordSupportStatusEnum, RecordTypeEnum, RecordUnitEnum
- public abstract class RecordDataElement
- extends java.lang.Object
- implements java.io.Serializable, IRecordDataElement
The top-level class for all record data elements. Record Classes store their property values in the classes that inherit from this abstract class. The RecordDataElement classes offer an input validation method, convert the Object received from the DataAdapter into their base type and convert this type back into a DataAdapter readable String value.
Each implementing class must also implement a public * getDataValue(); method, which returns a copy of the value in an approriate object type. RecordInteger has, for example:
public Integer getDataValue() {
if (value == null) {
return null;
} else {
return new Integer(value.intValue());
}
}
Take, for example, the RecordDate class: The assignDataValue() method, receives an Object that originates from the DataAdapterService, usually the SQL datasource. If the database field is a
DATE
or
DATETIME
field, that Object will be of type
java.util.Date or
null.
The
getDataValue() method returns a
Date object or null, the
getStringValue() returns a
String in the format: "YYYY-MM-DD HH:MM:SS", so that the database server can parse it.
The classes inherited from this class must be final and cannot have child classes, because the Record.getFields() method filters Record class member fields by their first level ancestry to this class (RecordDataElement).
|
Method Summary |
java.lang.String |
getFieldName()
Returns the database field name String for this RecordDataElement within the Record that has instantiated it. |
protected void |
setFieldName(java.lang.String fieldName)
Sets the database field name String for this RecordDataElement within the Record that instantiates it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fieldName
private java.lang.String fieldName
nullAllowed
protected boolean nullAllowed
RecordDataElement
public RecordDataElement(java.lang.String fieldName)
- Creates a new instance of a RecordDataElement which doesn't allow null values.
RecordDataElement
public RecordDataElement(java.lang.String fieldName,
boolean nullAllowed)
- Creates a new instance of a RecordDataElement
getFieldName
public java.lang.String getFieldName()
- Returns the database field name String for this RecordDataElement within the Record that has instantiated it.
setFieldName
protected void setFieldName(java.lang.String fieldName)
- Sets the database field name String for this RecordDataElement within the Record that instantiates it.