org.milyn.javabean.decoders
Class DateDecoder

java.lang.Object
  extended by org.milyn.javabean.decoders.LocaleAwareDecoder
      extended by org.milyn.javabean.decoders.LocaleAwareDateDecoder
          extended by org.milyn.javabean.decoders.DateDecoder
All Implemented Interfaces:
Serializable, Configurable, DataDecoder, DataEncoder
Direct Known Subclasses:
SqlDateDecoder, SqlTimeDecoder, SqlTimestampDecoder, XMLGregorianCalendarDecoder

@DecodeType(value=java.util.Date.class)
public class DateDecoder
extends LocaleAwareDateDecoder
implements DataDecoder, DataEncoder

Date data decoder.

Decodes the supplied string into a Date value based on the supplied "format" parameter, or the default (see below).

The default date format used is "yyyy-MM-dd'T'HH:mm:ss" (see SimpleDateFormat). This format is based on the ISO 8601 standard as used by the XML Schema type "dateTime".

This decoder is synchronized on its underlying SimpleDateFormat instance.

Author:
tom.fennelly@gmail.com
See Also:
LocaleAwareDateDecoder, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.milyn.javabean.DataDecoder
DataDecoder.Factory
 
Field Summary
 
Fields inherited from class org.milyn.javabean.decoders.LocaleAwareDateDecoder
decoder, DEFAULT_DATE_FORMAT, format, FORMAT, LOCALE_COUNTRY_CODE, LOCALE_LANGUAGE_CODE, VERIFY_LOCALE
 
Fields inherited from class org.milyn.javabean.decoders.LocaleAwareDecoder
LOCALE
 
Constructor Summary
DateDecoder()
           
 
Method Summary
 Object decode(String data)
          Decode the supplied String data into a new Object data instance.
 String encode(Object date)
          Encode an object to a string.
 
Methods inherited from class org.milyn.javabean.decoders.LocaleAwareDateDecoder
setConfiguration
 
Methods inherited from class org.milyn.javabean.decoders.LocaleAwareDecoder
getConfiguration, getLocale, getLocale, isLocalInstalled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateDecoder

public DateDecoder()
Method Detail

decode

public Object decode(String data)
              throws DataDecodeException
Description copied from interface: DataDecoder
Decode the supplied String data into a new Object data instance.

Specified by:
decode in interface DataDecoder
Parameters:
data - Data to be decoded.
Returns:
Decoded data Object.
Throws:
DataDecodeException - Error decoding data.

encode

public String encode(Object date)
              throws DataDecodeException
Description copied from interface: DataEncoder
Encode an object to a string.

Specified by:
encode in interface DataEncoder
Parameters:
date - The object to be encoded.
Returns:
The encoded object.
Throws:
DataDecodeException - Error encoding object.


Copyright © 2018. All rights reserved.