org.mmbase.datatypes
Class DateTimeDataType

java.lang.Object
  extended byorg.mmbase.core.AbstractDescriptor
      extended byorg.mmbase.datatypes.BasicDataType
          extended byorg.mmbase.datatypes.ComparableDataType
              extended byorg.mmbase.datatypes.DateTimeDataType
All Implemented Interfaces:
Cloneable, Comparable, DataType, Descriptor, Serializable

public class DateTimeDataType
extends ComparableDataType

The date-time datatype further describes Date objects. The date can be restricted to a certain period (using ComparableDataType.setMin(java.lang.Comparable, boolean), ComparableDataType.setMax(java.lang.Comparable, boolean), and Casting.toDate(java.lang.Object). The presentation logic can be specified using a pattern, see getPattern().

Since:
MMBase-1.8
Version:
$Id: DateTimeDataType.java,v 1.33 2006/04/11 21:53:10 michiel Exp $
Author:
Pierre van Rooden, Michiel Meeuwissen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.mmbase.datatypes.ComparableDataType
ComparableDataType.MaxRestriction, ComparableDataType.MinRestriction
 
Nested classes inherited from class org.mmbase.datatypes.BasicDataType
BasicDataType.AbstractRestriction, BasicDataType.EnumerationRestriction, BasicDataType.RequiredRestriction, BasicDataType.RestrictedEnumerationIterator, BasicDataType.StaticAbstractRestriction, BasicDataType.TypeRestriction, BasicDataType.UniqueRestriction
 
Nested classes inherited from class org.mmbase.datatypes.DataType
DataType.Restriction
 
Field Summary
static Date MAX_VALUE
           
static Date MIN_VALUE
           
 
Fields inherited from class org.mmbase.datatypes.ComparableDataType
maxRestriction, minRestriction
 
Fields inherited from class org.mmbase.datatypes.BasicDataType
DATATYPE_BUNDLE, enumerationRestriction, origin, requiredRestriction, typeRestriction, uniqueRestriction
 
Fields inherited from class org.mmbase.core.AbstractDescriptor
description, guiName, key
 
Fields inherited from interface org.mmbase.datatypes.DataType
ENFORCE_ABSOLUTE, ENFORCE_ALWAYS, ENFORCE_NEVER, ENFORCE_ONCHANGE, ENFORCE_ONCREATE, PROCESS_GET, PROCESS_SET, VALID, XMLNS
 
Constructor Summary
DateTimeDataType(String name)
          Constructor for DateTime field.
 
Method Summary
protected  Object castToValidate(Object value, Node node, Field field)
          Before validating the value, the value will be 'casted', on default this will be to the 'correct' type, but it can be a more generic type sometimes.
 Object clone(String name)
           Besides super.clone, it calls inheritProperties(BasicDataType) and ComparableDataType.cloneRestrictions(BasicDataType).
 Date getMax()
           
 Date getMin()
           
 DateTimePattern getPattern()
          The 'pattern' of a 'DateTime' value gives a DateTimePattern object which can be used as an indication for presentation.
protected  void inheritProperties(BasicDataType origin)
          Properties are members of the datatype that can easily be copied/clones.
 void setDefaultValue(Object o)
          
 void setPattern(String p, Locale locale)
          Set the pattern for a certain Locale.
protected  StringBuffer toStringBuffer()
           
 
Methods inherited from class org.mmbase.datatypes.ComparableDataType
cloneRestrictions, getDefaultValue, getMaxRestriction, getMinRestriction, inheritRestrictions, isMaxInclusive, isMinInclusive, setMax, setMin, toXml, validateCastedValue
 
Methods inherited from class org.mmbase.datatypes.BasicDataType
cast, cast, checkType, clone, compareTo, edit, equals, finish, finish, getBaseType, getBaseTypeIdentifier, getCloud, getCommitProcessor, getElement, getElement, getEnumerationFactory, getEnumerationRestriction, getEnumerationValue, getEnumerationValues, getOrigin, getProcessor, getProcessor, getRequiredRestriction, getTypeAsClass, getUniqueRestriction, hashCode, inherit, isCorrectType, isFinished, isRequired, isUnique, preCast, preCast, preCast, rewrite, setCommitProcessor, setProcessor, setProcessor, setRequired, setUnique, setXml, toString, toXml, validate, validate
 
Methods inherited from class org.mmbase.core.AbstractDescriptor
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.Descriptor
getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName
 

Field Detail

MIN_VALUE

public static final Date MIN_VALUE

MAX_VALUE

public static final Date MAX_VALUE
Constructor Detail

DateTimeDataType

public DateTimeDataType(String name)
Constructor for DateTime field.

Method Detail

setDefaultValue

public void setDefaultValue(Object o)
Description copied from class: BasicDataType

Specified by:
setDefaultValue in interface DataType
Overrides:
setDefaultValue in class BasicDataType

inheritProperties

protected void inheritProperties(BasicDataType origin)
Description copied from class: BasicDataType
Properties are members of the datatype that can easily be copied/clones.

Overrides:
inheritProperties in class BasicDataType

castToValidate

protected Object castToValidate(Object value,
                                Node node,
                                Field field)
                         throws CastException
Description copied from class: BasicDataType
Before validating the value, the value will be 'casted', on default this will be to the 'correct' type, but it can be a more generic type sometimes. E.g. for numbers this wil simply cast to Number.

Overrides:
castToValidate in class BasicDataType
Throws:
CastException

getMin

public Date getMin()
Returns:
the minimum value as an Date, or very very long ago if there is no minimum.

getMax

public Date getMax()
Returns:
the maximum value as an Date, or a very very in the future if there is no maximum.

getPattern

public DateTimePattern getPattern()
The 'pattern' of a 'DateTime' value gives a DateTimePattern object which can be used as an indication for presentation. Basicly, this can indicate whether the objects present e.g. only a date, only a time and whether e.g. this time includes seconds or not. DateTimePattern is actually a wrapper arround a pattern, and that is used here.


setPattern

public void setPattern(String p,
                       Locale locale)
Set the pattern for a certain Locale. See also getPattern().


clone

public Object clone(String name)
Description copied from class: BasicDataType
Besides super.clone, it calls BasicDataType.inheritProperties(BasicDataType) and BasicDataType.cloneRestrictions(BasicDataType). A clone is not finished. See BasicDataType.isFinished().

Specified by:
clone in interface DataType
Overrides:
clone in class ComparableDataType

toStringBuffer

protected StringBuffer toStringBuffer()
Overrides:
toStringBuffer in class ComparableDataType


MMBase build 1.8.1.20060716