|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.scopemvc.util.convertor.NullStringConvertor | +--org.scopemvc.util.convertor.DateStringConvertor
String convertor for type java.util.Date
. The Time part of
Date
instances are ignored. See DateTimeStringConvertor
and TimeStringConvertor
.
It uses one java.text.DateFormat for converting into String
and
set of DateFormat
s for parsing. Parsing formats are successively
used to try to parse until one is successful.
Formats are picked up from config (see DefaultScopeConfig
for details) or if none in config, the
default formatter is:
DateFormat.getDateInstance(DateFormat.MEDIUM)and default parsers are:
DateFormat.getDateInstance(DateFormat.FULL); DateFormat.getDateInstance(DateFormat.LONG); DateFormat.getDateInstance(DateFormat.MEDIUM); DateFormat.getDateInstance(DateFormat.SHORT);Note: the default parsing set is initialized during class loading and based on default platform locale. If application uses other locales, there will be need to set parsing objects explicitly.
DateTimeStringConvertor
,
TimeStringConvertor
Constructor Summary | |
DateStringConvertor()
Creates new DateStringConvertor. |
|
DateStringConvertor(java.text.DateFormat inFormatter,
java.text.DateFormat[] inParsers)
Creates new DateStringConvertor with specified formatter and parsers. |
Method Summary | |
protected java.text.DateFormat[] |
getDefaultParsers()
Gets the default parsers |
protected void |
initDefaults()
TODO: document the method |
void |
setFormatter(java.lang.Object inFormat)
Sets format used by this convertor for converting Date s into
String s. |
void |
setParsers(java.lang.Object[] inParsers)
Set parser array for this converter. |
java.lang.Object |
stringAsValue(java.lang.String inString)
Returns instance of java.util.Date .Parsing formats are
successively used to try to parse until one is successful or exception is
thrown. |
java.lang.String |
valueAsString(java.lang.Object inValue)
Formats object into String . |
Methods inherited from class org.scopemvc.util.convertor.NullStringConvertor |
getNullAsString, isNull, setNullAsString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DateStringConvertor()
public DateStringConvertor(java.text.DateFormat inFormatter, java.text.DateFormat[] inParsers)
inFormatter
- TODO: Describe the ParameterinParsers
- TODO: Describe the ParameterMethod Detail |
public final void setFormatter(java.lang.Object inFormat)
Date
s into
String
s.
inFormat
- The new formatter value
java.lang.IllegalArgumentException
- if passed format is null or not a
DateFormat or not a String.public final void setParsers(java.lang.Object[] inParsers)
inParsers
- The new parsers value
java.lang.IllegalArgumentException
- if the array is null
or
contains a non-String or non-DateFormat object.public java.lang.Object stringAsValue(java.lang.String inString) throws java.lang.IllegalArgumentException
java.util.Date
.Parsing formats are
successively used to try to parse until one is successful or exception is
thrown.
Empty, null
and getNullAsString()
strings are converted into null
.
inString
- TODO: Describe the Parameter
java.lang.IllegalArgumentException
- if can't convert from String using
current DateFormat
public java.lang.String valueAsString(java.lang.Object inValue) throws java.lang.IllegalArgumentException
StringConvertor
String
. It never return a null.
Implementing class can offer posibility to set string representation of
null
(such as "null"
or ""
),
however default representation should be ""
. Slightly
different null handling is performed in StringStringConvertor
class.
inValue
- TODO: Describe the Parameter
getNullAsString
java.lang.IllegalArgumentException
- it argument is not instance of java.util.Date
protected java.text.DateFormat[] getDefaultParsers()
protected void initDefaults()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |