Class FastDateFormat
java.lang.Object
org.pentaho.reporting.libraries.formatting.FastDateFormat
- All Implemented Interfaces:
Serializable
,Cloneable
,FastFormat
A wrapper around the java.text.SimpleDateFormat class. This wrapper limits the possible interactions with the wrapped
format class and therefore we can treat the implementation as immutable.
- Author:
- Thomas Morgner
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFastDateFormat
(int dateStyle, int timeStyle, Locale locale) Creates a new date-format for the given default date and time style.FastDateFormat
(int dateStyle, int timeStyle, Locale locale, TimeZone timeZone) Creates a new date-format for the given default date and time style along with a TimeZone.FastDateFormat
(String pattern) Creates a new date-format for the given pattern.FastDateFormat
(String pattern, Locale locale) Creates a new date-format for the given pattern and locale.FastDateFormat
(String pattern, Locale locale, TimeZone timeZone) -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones the formatter.Formats the given object in a formatter-specific way.Returns the current locale of the formatter.Returns the pattern for the date-format.void
Updates the locale of the choice format.void
setTimeZone
(TimeZone timeZone)
-
Constructor Details
-
FastDateFormat
Creates a new date-format for the given pattern.- Parameters:
pattern
- the pattern string.
-
FastDateFormat
Creates a new date-format for the given pattern and locale.- Parameters:
pattern
- the pattern string.locale
- the locale.
-
FastDateFormat
-
FastDateFormat
Creates a new date-format for the given default date and time style.- Parameters:
dateStyle
- the date-style, one of DateFormat#SHORT, DateFormat#MEDIUM, DateFormat#LONG, DateFormat#FULL or -1 for none.timeStyle
- the date-style, one of DateFormat#SHORT, DateFormat#MEDIUM, DateFormat#LONG, DateFormat#FULL or -1 for none.locale
- the locale.- Throws:
IllegalArgumentException
- if both date and time-style are set to -1.- See Also:
-
FastDateFormat
Creates a new date-format for the given default date and time style along with a TimeZone.- Parameters:
dateStyle
- the date-style, one of DateFormat#SHORT, DateFormat#MEDIUM, DateFormat#LONG, DateFormat#FULL or -1 for none.timeStyle
- the date-style, one of DateFormat#SHORT, DateFormat#MEDIUM, DateFormat#LONG, DateFormat#FULL or -1 for none.locale
- the locale.timeZone
- the timeZone to which dates are interpreted.- Throws:
IllegalArgumentException
- if both date and time-style are set to -1.- See Also:
-
-
Method Details
-
setLocale
Updates the locale of the choice format. This has no impact on the result of the choice-format computation.- Parameters:
locale
- the locale, never null.
-
getLocale
Returns the current locale of the formatter.- Specified by:
getLocale
in interfaceFastFormat
- Returns:
- the current locale, never null.
-
getPattern
Returns the pattern for the date-format.- Returns:
- the pattern.
-
format
Formats the given object in a formatter-specific way.- Specified by:
format
in interfaceFastFormat
- Parameters:
parameters
- the parameters for the formatting.- Returns:
- the formatted string.
-
clone
Clones the formatter.- Specified by:
clone
in interfaceFastFormat
- Overrides:
clone
in classObject
- Returns:
- the clone.
-
getTimeZone
-
setTimeZone
-