org.oreodata.metadata
Class DateField

java.lang.Object
  |
  +--org.oreodata.metadata.Field
        |
        +--org.oreodata.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

Field Summary
 
Fields inherited from class org.oreodata.metadata.Field
defaultValueString, intern, properties, sqlType
 
Constructor Summary
DateField()
           
 
Method Summary
 java.lang.Object convertToJDBC(java.lang.Object o)
          Method to support persisting records to a JDBC record set.
 java.lang.Object defaultValue()
          returns this field's "default value".
 java.lang.Object getCopy(java.lang.Object o)
          Used when encapsulation requires Record::get() 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 org.oreodata.metadata.Field
checkValidValue, convertFromJDBC, createSAXHandler, getLocalizedName, getName, getProperty, getSQLType, hashCode, intern, isFieldOf, isRequired, isSetExternally, normalize, processNormalization, processProperties, 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
org.xml.sax.SAXException

processDefaultValue

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

getJavaType

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

Specified by:
getJavaType in interface FieldDescriptor
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.

Specified by:
defaultValue in interface FieldDescriptor
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.

MangledDataException

getCopy

public java.lang.Object getCopy(java.lang.Object o)
Description copied from interface: FieldDescriptor
Used when encapsulation requires Record::get() 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.

Specified by:
getCopy in interface FieldDescriptor
Overrides:
getCopy in class Field
Returns:
a copy of the object in question.

valueToString

public java.lang.String valueToString(java.lang.Object o)
synchronized because DateFormat is not synchronized

Specified by:
valueToString in interface FieldDescriptor
Overrides:
valueToString in class Field

convertToJDBC

public java.lang.Object convertToJDBC(java.lang.Object o)
Description copied from interface: FieldDescriptor
Method to support persisting records to a JDBC record set. Takes the result returned by this method and passes it to PreparedStatement.setObject(). In many cases, for strings and numbers, we should get away with this just being a pass-through.

Specified by:
convertToJDBC in interface FieldDescriptor
Overrides:
convertToJDBC in class Field