Package org.pepstock.charba.client.intl
Class DateTimeFormat
- java.lang.Object
-
- org.pepstock.charba.client.intl.DateTimeFormat
-
-
Constructor Summary
Constructors Constructor Description DateTimeFormat()
Creates object that enable language sensitive date time formatting, using the default locale.DateTimeFormat(CLocale locale)
Creates object that enable language sensitive date time formatting, using the locale options.DateTimeFormat(CLocale locale, DateTimeFormatOptions options)
Creates object that enables language sensitive date time formatting, using the locale options and specific options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(T value)
Formats a value according to the locale and formatting options of this object.List<FormatPart>
formatToParts(T value)
Returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts.
It is useful for custom formatting of value strings.CLocale
getLocale()
Returns the locale which has initialized the format.R
resolvedOptions()
Returns a new object with properties reflecting the locale and value formatting options computed during initialization of this object.
-
-
-
Constructor Detail
-
DateTimeFormat
public DateTimeFormat()
Creates object that enable language sensitive date time formatting, using the default locale.
-
DateTimeFormat
public DateTimeFormat(CLocale locale)
Creates object that enable language sensitive date time formatting, using the locale options.- Parameters:
locale
- a locale instance
-
DateTimeFormat
public DateTimeFormat(CLocale locale, DateTimeFormatOptions options)
Creates object that enables language sensitive date time formatting, using the locale options and specific options.- Parameters:
locale
- a locale instanceoptions
- options to configure the date time format
-
-
Method Detail
-
getLocale
public final CLocale getLocale()
Returns the locale which has initialized the format.- Returns:
- the locale which has initialized the format
-
format
public final String format(T value)
Formats a value according to the locale and formatting options of this object.- Parameters:
value
- the vale to format- Returns:
- the value in the a string according to the locale and formatting options
-
resolvedOptions
public final R resolvedOptions()
Returns a new object with properties reflecting the locale and value formatting options computed during initialization of this object.- Returns:
- new object with properties reflecting the locale and value formatting options computed during initialization of this object
-
formatToParts
public final List<FormatPart> formatToParts(T value)
Returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts.
It is useful for custom formatting of value strings.- Parameters:
value
- value to format- Returns:
- an array of objects containing the formatted value in parts.
-
-