public class DateTimeFormatterFactory extends Object
DateTimeFormatter
.
Formatters will be created using the defined pattern
,
ISO
, and style
methods (considered in that order).
createDateTimeFormatter()
,
createDateTimeFormatter(DateTimeFormatter)
,
setPattern(java.lang.String)
,
setStyle(java.lang.String)
,
setIso(org.springframework.format.annotation.DateTimeFormat.ISO)
,
DateTimeFormatterFactoryBean
Constructor and Description |
---|
DateTimeFormatterFactory()
Create a new
DateTimeFormatterFactory instance. |
DateTimeFormatterFactory(String pattern)
Create a new
DateTimeFormatterFactory instance. |
Modifier and Type | Method and Description |
---|---|
DateTimeFormatter |
createDateTimeFormatter()
Create a new
DateTimeFormatter using this factory. |
DateTimeFormatter |
createDateTimeFormatter(DateTimeFormatter fallbackFormatter)
Create a new
DateTimeFormatter using this factory. |
void |
setIso(DateTimeFormat.ISO iso)
Set the ISO format used to format date values.
|
void |
setPattern(String pattern)
Set the pattern to use to format date values.
|
void |
setStyle(String style)
Set the two characters to use to format date values, in Joda-Time style.
|
void |
setTimeZone(TimeZone timeZone)
Set the
TimeZone to normalize the date values into, if any. |
public DateTimeFormatterFactory()
DateTimeFormatterFactory
instance.public DateTimeFormatterFactory(String pattern)
DateTimeFormatterFactory
instance.pattern
- the pattern to use to format date valuespublic void setPattern(String pattern)
pattern
- the format patternpublic void setIso(DateTimeFormat.ISO iso)
iso
- the ISO formatpublic void setStyle(String style)
The first character is used for the date style; the second is for the time style. Supported characters are:
style
- two characters from the set {"S", "M", "L", "F", "-"}public void setTimeZone(TimeZone timeZone)
TimeZone
to normalize the date values into, if any.timeZone
- the time zonepublic DateTimeFormatter createDateTimeFormatter()
DateTimeFormatter
using this factory.
If no specific pattern or style has been defined,
medium date time format
will be used.
createDateTimeFormatter(DateTimeFormatter)
public DateTimeFormatter createDateTimeFormatter(DateTimeFormatter fallbackFormatter)
DateTimeFormatter
using this factory.
If no specific pattern or style has been defined,
the supplied fallbackFormatter
will be used.
fallbackFormatter
- the fall-back formatter to use when no specific
factory properties have been set (can be null
).