- All Superinterfaces:
Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SubFormatteralternativeFormatter(String modifier, Locale locale) Formatter that always formats the given modifier as a pattern instead of using the given parameter.static SubFormatterbooleanFormatter(String modifier, Locale locale) static SubFormatterchoiceFormatter(String modifier, Locale locale) static SubFormatterdateFormatter(String modifier, Locale locale) static SubFormatterdateTimeFormatter(String modifier, Locale locale) format(String name, Map<? super String, ?> parameters, Function<String, NameBasedMessageFormat> nameBasedMessageFormatFactory) Formats the the parameter with the given name from the given set of parameters.static SubFormatternumberFormatter(String modifier, Locale locale) static SubFormatteroptionalFormatter(String modifier, Locale locale) static SubFormatterstringFormatter(String modifier, Locale locale) static SubFormattertimeFormatter(String modifier, Locale locale)
-
Method Details
-
format
String format(String name, Map<? super String, ?> parameters, Function<String, NameBasedMessageFormat> nameBasedMessageFormatFactory) Formats the the parameter with the given name from the given set of parameters.SubFormatters can recursively format messages using the supplied parameters and the givenNameBasedMessageFormatfactory. TheNameBasedMessageFormatfactory should create an instance that uses the same settings as the format that is calling the current sub-formatter, but with a different pattern.- Parameters:
name- the name of the parameter to formatparameters- the map that contains all the parameters used in the current formatter operationnameBasedMessageFormatFactory- a factory to create a newNameBasedMessageFormatfor any recursively defined message patterns.- Returns:
- the formatted parameter
-
stringFormatter
-
numberFormatter
-
dateFormatter
-
dateTimeFormatter
-
timeFormatter
-
choiceFormatter
-
optionalFormatter
-
booleanFormatter
-
alternativeFormatter
Formatter that always formats the given modifier as a pattern instead of using the given parameter. This formatter may be useful for testing or for more complex dynamic formatting.- Parameters:
modifier- theStringto use as alternativelocale- the locale to use when formatting- Returns:
- a formatter that outputs the given modifier, formatted as pattern
-