org.pm4j.core.pm.impl.converter
Class PmConverterDate

java.lang.Object
  extended by org.pm4j.core.pm.impl.converter.PmConverterSerializeableBase<java.util.Date>
      extended by org.pm4j.core.pm.impl.converter.PmConverterDate
All Implemented Interfaces:
PmAttr.Converter<java.util.Date>

public class PmConverterDate
extends PmConverterSerializeableBase<java.util.Date>


Field Summary
static java.lang.String FALLBACK_FORMAT_PATTERN
          The format pattern that is used when no format pattern resource was found for the current PM locale.
protected  java.lang.String formatSplitString
          The separator string used in case of a multi-format resource string specification.
static PmConverterDate INSTANCE
           
 
Constructor Summary
PmConverterDate()
           
 
Method Summary
 java.lang.String getOutputFormat(PmAttr<?> pmAttr)
          The last format definition returned by getParseFormats(PmAttr).
 java.lang.String[] getParseFormats(PmAttr<?> pmAttr)
          Translates the (optionally semicolon delimited) language specific format value in an array set of formats that is used to parse date strings.
 java.util.Date stringToValue(PmAttr<?> pmAttr, java.lang.String s)
           
 java.lang.String valueToString(PmAttr<?> pmAttr, java.util.Date value)
          Just calls the Object.toString() method of the given value.
 
Methods inherited from class org.pm4j.core.pm.impl.converter.PmConverterSerializeableBase
serializeableToValue, valueToSerializable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FALLBACK_FORMAT_PATTERN

public static final java.lang.String FALLBACK_FORMAT_PATTERN
The format pattern that is used when no format pattern resource was found for the current PM locale.

See Also:
Constant Field Values

INSTANCE

public static final PmConverterDate INSTANCE

formatSplitString

protected java.lang.String formatSplitString
The separator string used in case of a multi-format resource string specification.

Constructor Detail

PmConverterDate

public PmConverterDate()
Method Detail

stringToValue

public java.util.Date stringToValue(PmAttr<?> pmAttr,
                                    java.lang.String s)

valueToString

public java.lang.String valueToString(PmAttr<?> pmAttr,
                                      java.util.Date value)
Description copied from class: PmConverterSerializeableBase
Just calls the Object.toString() method of the given value.

This solution works if the Object.toString() implementation provides the information needed for the PmAttr.Converter.stringToValue(PmAttr, String) method call.

Specified by:
valueToString in interface PmAttr.Converter<java.util.Date>
Overrides:
valueToString in class PmConverterSerializeableBase<java.util.Date>

getParseFormats

public java.lang.String[] getParseFormats(PmAttr<?> pmAttr)
Translates the (optionally semicolon delimited) language specific format value in an array set of formats that is used to parse date strings.

The last item will be used as string output format.

When the language specific format is not defined or empty, the FALLBACK_FORMAT_PATTERN will be returned.

Returns:
The accepted input formats.

getOutputFormat

public java.lang.String getOutputFormat(PmAttr<?> pmAttr)
The last format definition returned by getParseFormats(PmAttr).

Is used for the method PmAttr.getValueAsString().

It is also intended to be used by UI help constructs such as calendar popups which provide their data as strings.

Returns:
The last item of the result of getParseFormats(PmAttr)