Package org.omnifaces.utils.text
Interface SubFormatter
-
- 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.
@FunctionalInterface public interface SubFormatter extends Serializable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static SubFormatter
alternativeFormatter(String modifier, Locale locale)
Formatter that always formats the given modifier as a pattern instead of using the given parameter.static SubFormatter
booleanFormatter(String modifier, Locale locale)
static SubFormatter
choiceFormatter(String modifier, Locale locale)
static SubFormatter
dateFormatter(String modifier, Locale locale)
static SubFormatter
dateTimeFormatter(String modifier, Locale locale)
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.static SubFormatter
numberFormatter(String modifier, Locale locale)
static SubFormatter
optionalFormatter(String modifier, Locale locale)
static SubFormatter
stringFormatter(String modifier, Locale locale)
static SubFormatter
timeFormatter(String modifier, Locale locale)
-
-
-
Method Detail
-
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.SubFormatter
s can recursively format messages using the supplied parameters and the givenNameBasedMessageFormat
factory. TheNameBasedMessageFormat
factory 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 newNameBasedMessageFormat
for any recursively defined message patterns.- Returns:
- the formatted parameter
-
stringFormatter
static SubFormatter stringFormatter(String modifier, Locale locale)
-
numberFormatter
static SubFormatter numberFormatter(String modifier, Locale locale)
-
dateFormatter
static SubFormatter dateFormatter(String modifier, Locale locale)
-
dateTimeFormatter
static SubFormatter dateTimeFormatter(String modifier, Locale locale)
-
timeFormatter
static SubFormatter timeFormatter(String modifier, Locale locale)
-
choiceFormatter
static SubFormatter choiceFormatter(String modifier, Locale locale)
-
optionalFormatter
static SubFormatter optionalFormatter(String modifier, Locale locale)
-
booleanFormatter
static SubFormatter booleanFormatter(String modifier, Locale locale)
-
alternativeFormatter
static SubFormatter alternativeFormatter(String modifier, Locale locale)
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
- theString
to use as alternativelocale
- the locale to use when formatting- Returns:
- a formatter that outputs the given modifier, formatted as pattern
-
-