public final class FormatterProvider extends Object
Formatter
s for various types. It contains the formatting logic for various
implementations of SimpleNlsFormatter
. This way it is easier to maintain GWT
compatibility by replacing this class.Modifier and Type | Class and Description |
---|---|
private static class |
FormatterProvider.FormatFormatter
|
private static class |
FormatterProvider.Iso8601Formatter
|
Modifier | Constructor and Description |
---|---|
private |
FormatterProvider()
Construction prohibited.
|
Modifier and Type | Method and Description |
---|---|
private static int |
convertStyle(String style)
This method converts the given
style to the according
DateFormat -style constant. |
static Formatter<Object> |
getCurrencyFormatter(Locale locale) |
static Formatter<Object> |
getDateFormatter(Locale locale,
String pattern) |
static Formatter<Object> |
getDateFormatter(Locale locale,
String type,
Iso8601Util iso8601Util) |
static Formatter<Object> |
getDateFormatter(Locale locale,
String type,
String style) |
static Formatter<Object> |
getIntegerFormatter(Locale locale) |
static Formatter<Object> |
getNumberFormatter(Locale locale) |
static Formatter<Object> |
getNumberFormatter(Locale locale,
String pattern) |
static Formatter<Object> |
getPercentFormatter(Locale locale) |
private static int convertStyle(String style)
style
to the according
DateFormat
-style constant.style
- is the style
to convert.DateFormat
-style constant (e.g. DateFormat.MEDIUM
).public static Formatter<Object> getDateFormatter(Locale locale, String type, String style)
locale
- is the Locale
.type
- is the type
(must be one of
NlsFormatterManager.TYPE_DATE
, NlsFormatterManager.TYPE_TIME
,
NlsFormatterManager.TYPE_DATETIME
).style
- is the style
.FormatterProvider
for Integer
.public static Formatter<Object> getDateFormatter(Locale locale, String pattern)
locale
- is the Locale
.pattern
- is the custom format pattern.FormatterProvider
for Integer
.public static Formatter<Object> getDateFormatter(Locale locale, String type, Iso8601Util iso8601Util)
locale
- is the Locale
.type
- is the type
(must be one of
NlsFormatterManager.TYPE_DATE
, NlsFormatterManager.TYPE_TIME
,
NlsFormatterManager.TYPE_DATETIME
).iso8601Util
- is the Iso8601Util
.FormatterProvider
for Integer
.public static Formatter<Object> getIntegerFormatter(Locale locale)
locale
- is the Locale
.FormatterProvider
for Integer
.public static Formatter<Object> getNumberFormatter(Locale locale)
locale
- is the Locale
.FormatterProvider
for Number
.public static Formatter<Object> getNumberFormatter(Locale locale, String pattern)
locale
- is the Locale
.pattern
- is the format pattern
for the Number
.FormatterProvider
for Number
.public static Formatter<Object> getCurrencyFormatter(Locale locale)
locale
- is the Locale
.FormatterProvider
for a Number
as currency.Copyright © 2001–2016 mmm-Team. All rights reserved.