biz.c24.io.api.data
Class GenericDateDataType

java.lang.Object
  extended by biz.c24.io.api.data.DataType
      extended by biz.c24.io.api.data.SimpleDataType
          extended by biz.c24.io.api.data.AtomicDataType
              extended by biz.c24.io.api.data.DateDataType
                  extended by biz.c24.io.api.data.GenericDateDataType
All Implemented Interfaces:
FormatableDataType, ModelComponent, Serializable

public class GenericDateDataType
extends DateDataType
implements FormatableDataType

A simple data type representing a Date.

Warning: Serialized objects of this class or of a deployed class which is derived from it may not be compatible with future releases of C24 Integreation Objects. The current serialization support is appropriate for short term storage or RMI between applications running the same version of C24 Integreation Objects.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class biz.c24.io.api.data.AtomicDataType
AtomicDataType.FinalEnum
 
Field Summary
protected static Calendar CALENDAR
          Calendar instance (shared) to be used for date/time calculation with time zones.
protected static TimeZone TIME_ZONE_UTC
          UTC time zone instance.
 
Fields inherited from class biz.c24.io.api.data.DataType
duringParsing, hasEnumerations, hasPatternMatching, qualifierValidation
 
Constructor Summary
GenericDateDataType()
          Create a new instance.
 
Method Summary
 Format createFormat(int idx)
          Returns the format with specified index.
 Object createObject(Date value)
          Creates and returns a new date with the specified value.
 Object createObject(long value)
          Creates and returns a new date with the specified value.
 Object createObject(long value, TimeZone timeZone)
          Creates and returns a new date with the specified value.
 String formatObjectOverride(Object obj)
           
 String[] getAllFormatPatterns()
          Returns the format pattern(s).
 DateFormat[] getAllFormats()
          Deprecated. Use the formatCount and format[index] instead.
 DateStyleEnum getDateStyle()
          Returns the date style to use when localised.
 DateFormat getFormat()
          Deprecated. Use the {format[index] instead.
 DateFormat getFormat(int idx)
          Returns the format object with specified index.
 String getFormatPattern()
          Returns the main format pattern.
 int getFormatsCount()
          Returns the defined formats count or 0 if there is no any.
static DataType getInstance()
          Returns a singleton instance.
 Object getMaxExclusive()
          Returns the maximum exclusive value (optional operation).
 Object getMaxInclusive()
          Returns the maximum inclusive value (optional operation).
 int getMaxSize()
          Returns the maximum allowable size of the value.
 Object getMinExclusive()
          Returns the minimum exclusive value (optional operation).
 Object getMinInclusive()
          Returns the minimum inclusive value (optional operation).
 DatePatternInstanceEnum getPatternInstance()
          Returns the pattern instance to use when localised.
 DateStyleEnum getTimeStyle()
          Returns the time style to use when localised.
 TimeZone getTimeZone()
          Returns the time zone.
 String getTwoDigitYearStart()
          Returns the start date after which two digit years should be parsed.
 Class getValidObjectClass()
          Returns the class of valid objects of this type.
 boolean isDate()
          Returns whether this type allows date components (e.g. yyyy-MM-dd).
 boolean isISO8601Based()
           
 boolean isLenient()
          Returns whether the date format is lenient.
 boolean isTime()
          Returns whether this type allows time components (e.g.
 Object parseObject(String str, ParsePosition pp)
           
 Object parseObject(String str, ParsePosition pp, String datePattern)
          Parses the supplied str into an object.
 void setAllFormatPatterns(String[] formatPattern)
          Sets the format pattern(s).
 void setDateStyle(DateStyleEnum dateStyle)
          Sets the date style to use when localised.
 void setFormatPattern(String formatPattern)
          Sets the main format pattern.
 void setLenient(boolean lenient)
          Sets whether the date format is lenient.
 void setMaxExclusive(Object maxExclusive)
          Sets the maximum exclusive value (optional operation).
 void setMaxInclusive(Object maxInclusive)
          Sets the maximum inclusive value (optional operation).
 void setMinExclusive(Object minExclusive)
          Sets the minimum exclusive value (optional operation).
 void setMinInclusive(Object minInclusive)
          Sets the minimum inclusive value (optional operation).
 void setPatternInstance(DatePatternInstanceEnum patternInstance)
          Sets the pattern instance to use when localised.
 void setTimeStyle(DateStyleEnum timeStyle)
          Sets the time style to use when localised.
 void setTimeZone(TimeZone timeZone)
          Sets the time zone.
 void setTwoDigitYearStart(String twoDigitYearStart)
          Sets the start date after which two digit years should be parsed.
 
Methods inherited from class biz.c24.io.api.data.DateDataType
getMinSize
 
Methods inherited from class biz.c24.io.api.data.AtomicDataType
formatObject, getFinal, getLocale, getPad, getPadAmount, getPadJustification, getWhiteSpace, parseObject, setFinal, setLocale, setPad, setPadAmount, setPadJustification, setWhiteSpace
 
Methods inherited from class biz.c24.io.api.data.SimpleDataType
formatObject, formatObjectExternal, isComplex, isSimple, isSizeFixed, parseObject, parseObjectExternal, validateProperties
 
Methods inherited from class biz.c24.io.api.data.DataType
addDerivedType, addValidator, addValidator, derivedTypeKeySet, getAnnotation, getDatabaseColumnName, getDerivedType, getDerivedType, getDerivedTypes, getDescription, getEnumeration, getInitiator, getModel, getName, getNullDefiningElementDecl, getOriginalName, getOriginalPatternMatch, getPatternMatch, getPatternType, getTerminator, getValidator, getValidatorCount, getValidatorIndex, hasDerivedTypes, isLocal, isValidObjectClass, removeDerivedType, removeValidator, setAnnotation, setDatabaseColumnName, setInitiator, setLocal, setModel, setName, setOriginalName, setOriginalPatternMatch, setPatternMatch, setPatternType, setTerminator, toString, validate, validateProperties, validateProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CALENDAR

protected static final Calendar CALENDAR
Calendar instance (shared) to be used for date/time calculation with time zones. Access/usage must be synchronized.


TIME_ZONE_UTC

protected static final TimeZone TIME_ZONE_UTC
UTC time zone instance.

Constructor Detail

GenericDateDataType

public GenericDateDataType()
Create a new instance.

Method Detail

getInstance

public static DataType getInstance()
Returns a singleton instance.

Returns:
A singleton.

isDate

public boolean isDate()
Description copied from class: DateDataType
Returns whether this type allows date components (e.g. yyyy-MM-dd).

Specified by:
isDate in class DateDataType
Returns:
Whether date components are allowed.

isTime

public boolean isTime()
Description copied from class: DateDataType
Returns whether this type allows time components (e.g. HH-mm-ss).

Specified by:
isTime in class DateDataType
Returns:
Whether time components are allowed.

createObject

public Object createObject(Date value)
Description copied from class: DateDataType
Creates and returns a new date with the specified value.

Specified by:
createObject in class DateDataType
Parameters:
value - The value.
Returns:
The new date (not necessarily a java.util.Date).

createObject

public Object createObject(long value)
Description copied from class: DateDataType
Creates and returns a new date with the specified value.

Specified by:
createObject in class DateDataType
Parameters:
value - The value.
Returns:
The new date (not necessarily a java.util.Date).

createObject

public Object createObject(long value,
                           TimeZone timeZone)
Description copied from class: DateDataType
Creates and returns a new date with the specified value.

Specified by:
createObject in class DateDataType
Parameters:
value - The value.
timeZone - The time zone.
Returns:
The new date (not necessarily a java.util.Date).

getValidObjectClass

public Class getValidObjectClass()
Description copied from class: DataType
Returns the class of valid objects of this type.

Overrides:
getValidObjectClass in class DateDataType
Returns:
The class.

isISO8601Based

public final boolean isISO8601Based()
Specified by:
isISO8601Based in class DateDataType

getFormat

public DateFormat getFormat()
Deprecated. Use the {format[index] instead.

Returns the format object.

Returns:
The format object.

getFormatsCount

public int getFormatsCount()
Returns the defined formats count or 0 if there is no any.

Specified by:
getFormatsCount in interface FormatableDataType
Returns:
The defined formats count.

getFormat

public DateFormat getFormat(int idx)
Returns the format object with specified index.

Parameters:
idx - The index of requested format.
Returns:
The format object.

getAllFormats

public DateFormat[] getAllFormats()
Deprecated. Use the formatCount and format[index] instead.

Returns all the format objects.

Returns:
The format object.

getFormatPattern

public String getFormatPattern()
Returns the main format pattern.

Returns:
The format pattern.

getAllFormatPatterns

public String[] getAllFormatPatterns()
Returns the format pattern(s). Any item in the returned array is considered a valid pattern for parsing but the first item will always be used when formatting. The array returned by this method will never be of length 0, it will be null if no patterns have been specified.

Returns:
The format pattern(s).

setFormatPattern

public void setFormatPattern(String formatPattern)
Sets the main format pattern.

Parameters:
formatPattern - The format pattern.

setAllFormatPatterns

public void setAllFormatPatterns(String[] formatPattern)
Sets the format pattern(s).

Parameters:
formatPattern - The valid format pattern(s).

getPatternInstance

public DatePatternInstanceEnum getPatternInstance()
Returns the pattern instance to use when localised.

Returns:
The instance.

setPatternInstance

public void setPatternInstance(DatePatternInstanceEnum patternInstance)
Sets the pattern instance to use when localised.

Parameters:
patternInstance - The instance.

getDateStyle

public DateStyleEnum getDateStyle()
Returns the date style to use when localised.

Returns:
The date style.

setDateStyle

public void setDateStyle(DateStyleEnum dateStyle)
Sets the date style to use when localised.

Parameters:
dateStyle - The date style.

getTimeStyle

public DateStyleEnum getTimeStyle()
Returns the time style to use when localised.

Returns:
The time style.

setTimeStyle

public void setTimeStyle(DateStyleEnum timeStyle)
Sets the time style to use when localised.

Parameters:
timeStyle - The time style.

isLenient

public boolean isLenient()
Returns whether the date format is lenient.

Returns:
The lenient value

setLenient

public void setLenient(boolean lenient)
Sets whether the date format is lenient.

Parameters:
lenient - The lenient value

getTwoDigitYearStart

public String getTwoDigitYearStart()
Returns the start date after which two digit years should be parsed.

Returns:
The two digit year start value.

setTwoDigitYearStart

public void setTwoDigitYearStart(String twoDigitYearStart)
Sets the start date after which two digit years should be parsed.

Parameters:
twoDigitYearStart - The new value.

getTimeZone

public TimeZone getTimeZone()
Returns the time zone.

Returns:
The time zone.

setTimeZone

public void setTimeZone(TimeZone timeZone)
Sets the time zone.

Parameters:
timeZone - The time zone.

getMaxInclusive

public Object getMaxInclusive()
Description copied from class: SimpleDataType
Returns the maximum inclusive value (optional operation).

Overrides:
getMaxInclusive in class SimpleDataType
Returns:
The maximum inclusive value.

setMaxInclusive

public void setMaxInclusive(Object maxInclusive)
Description copied from class: SimpleDataType
Sets the maximum inclusive value (optional operation).

Overrides:
setMaxInclusive in class SimpleDataType
Parameters:
maxInclusive - The maximum inclusive value.

getMinInclusive

public Object getMinInclusive()
Description copied from class: SimpleDataType
Returns the minimum inclusive value (optional operation).

Overrides:
getMinInclusive in class SimpleDataType
Returns:
The minimum inclusive value.

setMinInclusive

public void setMinInclusive(Object minInclusive)
Description copied from class: SimpleDataType
Sets the minimum inclusive value (optional operation).

Overrides:
setMinInclusive in class SimpleDataType
Parameters:
minInclusive - The minimum inclusive value.

getMaxExclusive

public Object getMaxExclusive()
Description copied from class: SimpleDataType
Returns the maximum exclusive value (optional operation).

Overrides:
getMaxExclusive in class SimpleDataType
Returns:
The maximum exclusive value.

setMaxExclusive

public void setMaxExclusive(Object maxExclusive)
Description copied from class: SimpleDataType
Sets the maximum exclusive value (optional operation).

Overrides:
setMaxExclusive in class SimpleDataType
Parameters:
maxExclusive - The maximum exclusive value.

getMinExclusive

public Object getMinExclusive()
Description copied from class: SimpleDataType
Returns the minimum exclusive value (optional operation).

Overrides:
getMinExclusive in class SimpleDataType
Returns:
The minimum exclusive value.

setMinExclusive

public void setMinExclusive(Object minExclusive)
Description copied from class: SimpleDataType
Sets the minimum exclusive value (optional operation).

Overrides:
setMinExclusive in class SimpleDataType
Parameters:
minExclusive - The minimum exclusive value.

createFormat

public Format createFormat(int idx)
Description copied from interface: FormatableDataType
Returns the format with specified index.

Specified by:
createFormat in interface FormatableDataType
Parameters:
idx - The index of requested format.
Returns:
The requested format.

getMaxSize

public int getMaxSize()
Description copied from class: SimpleDataType
Returns the maximum allowable size of the value.

Overrides:
getMaxSize in class DateDataType
Returns:
The maximum size or -1 if the size is unbounded.

parseObject

public Object parseObject(String str,
                          ParsePosition pp)

parseObject

public Object parseObject(String str,
                          ParsePosition pp,
                          String datePattern)
Parses the supplied str into an object.

Parameters:
str - The string to be parsed.
pp - The index at which parsing should start and, on the methods return, either the index at which parsing finished or the index at which an error occurred.
Returns:
The object, or null if parsing failed.

formatObjectOverride

public String formatObjectOverride(Object obj)
Specified by:
formatObjectOverride in class AtomicDataType


C24 Technologies © 2002-2012: All Rights Reserved.