com.revusky.niggle.data.metadata
Class DateField

java.lang.Object
  |
  +--com.revusky.niggle.data.metadata.Field
        |
        +--com.revusky.niggle.data.metadata.DateField
All Implemented Interfaces:
FieldDescriptor, java.io.Serializable

public class DateField
extends Field

A descriptor for a field that holds a date or timestamp (probably a misnomer, should be called TimeStampField)

Author:
Jonathan Revusky
See Also:
Serialized Form

Fields inherited from class com.revusky.niggle.data.metadata.Field
defaultValueString, sqlType
 
Constructor Summary
DateField()
           
 
Method Summary
 java.lang.Object defaultValue()
          returns this field's "default value".
 java.lang.Object getCopy(java.lang.Object o)
          Used when encapsulation requires Record::getFieldValue() to return a clone of an object.
 java.lang.Class getJavaType()
          The kind of java object that can live in this record field.
 java.lang.Object getObjectFromString(Record rec, java.lang.String value)
          method is synchronized because DateFormat is not thread-safe.
protected  void init(org.w3c.dom.Element element)
           
protected  void processDefaultValue()
           
 java.lang.String valueToString(java.lang.Object o)
          synchronized because DateFormat is not synchronized
 
Methods inherited from class com.revusky.niggle.data.metadata.Field
capitalizeFirstLetter, checkValidValue, convertFromJDBC, getLocalizedName, getName, getSQLType, hashCode, isFieldOf, isRequired, normalize, setDefaultValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateField

public DateField()
Method Detail

init

protected void init(org.w3c.dom.Element element)
             throws org.xml.sax.SAXException
Overrides:
init in class Field

processDefaultValue

protected void processDefaultValue()
                            throws java.io.IOException
Overrides:
processDefaultValue in class Field

getJavaType

public java.lang.Class getJavaType()
Description copied from interface: FieldDescriptor
The kind of java object that can live in this record field.
Overrides:
getJavaType in class Field

defaultValue

public java.lang.Object defaultValue()
Description copied from interface: FieldDescriptor
returns this field's "default value". By default, this will be null.
Overrides:
defaultValue in class Field

getObjectFromString

public java.lang.Object getObjectFromString(Record rec,
                                            java.lang.String value)
                                     throws MangledDataException
method is synchronized because DateFormat is not thread-safe.

getCopy

public java.lang.Object getCopy(java.lang.Object o)
Description copied from interface: FieldDescriptor
Used when encapsulation requires Record::getFieldValue() to return a clone of an object. In the case of immutable objects such as java.lang.String, getCopy() can just return the object passed in as a parameter.
Overrides:
getCopy in class Field
Following copied from interface: com.revusky.niggle.data.FieldDescriptor
Returns:
a copy of the object in question.

valueToString

public java.lang.String valueToString(java.lang.Object o)
synchronized because DateFormat is not synchronized
Overrides:
valueToString in class Field