Package com.ibm.icu.message2
Class MFDataModelFormatter
java.lang.Object
com.ibm.icu.message2.MFDataModelFormatter
Takes an
MFDataModel
and formats it to a String
(and later on we will also implement formatting to a FormattedMessage
).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
(package private) static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MessageFormatter.BidiIsolation
private final MFFunctionRegistry
private final MFDataModel.Message
private static final MFFunctionRegistry
private final MessageFormatter.ErrorHandlingBehavior
private static final char
private final Locale
private static final char
private static final char
private static final char
private final MFFunctionRegistry
-
Constructor Summary
ConstructorsConstructorDescriptionMFDataModelFormatter
(MFDataModel.Message dm, Locale locale, MessageFormatter.ErrorHandlingBehavior errorHandlingBehavior, MessageFormatter.BidiIsolation bidiIsolation, MFFunctionRegistry customFunctionRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprivate static MFDataModelFormatter.MapWithNfcKeys
convertOptions
(Map<String, MFDataModel.Option> options, MFDataModelFormatter.MapWithNfcKeys localVars, MFDataModelFormatter.MapWithNfcKeys arguments) private static void
fatalFormattingError
(String message) private MFDataModel.Pattern
findBestMatchingPattern
(MFDataModel.SelectMessage sm, MFDataModelFormatter.MapWithNfcKeys variables, MFDataModelFormatter.MapWithNfcKeys arguments) (package private) String
private FormattedPlaceholder
formatExpression
(MFDataModel.Expression expression, MFDataModelFormatter.MapWithNfcKeys variables, MFDataModelFormatter.MapWithNfcKeys arguments) Formats an expression.private FormatterFactory
getFormattingFunctionFactoryByName
(Object toFormat, String functionName) private void
implementBiDiDefault
(StringBuilder result, Directionality msgdir, FormattedPlaceholder formattedExpression) spec: The method MatchSelectorKeys is determined by the implementation.resolveDeclarations
(List<MFDataModel.Declaration> declarations, MFDataModelFormatter.MapWithNfcKeys arguments) private static Object
resolveLiteralOrVariable
(MFDataModel.LiteralOrVariableRef value, MFDataModelFormatter.MapWithNfcKeys localVars, MFDataModelFormatter.MapWithNfcKeys arguments) private static int
-
Field Details
-
LRI
private static final char LRI- See Also:
-
RLI
private static final char RLI- See Also:
-
FSI
private static final char FSI- See Also:
-
PDI
private static final char PDI- See Also:
-
locale
-
errorHandlingBehavior
-
bidiIsolation
-
dm
-
standardFunctions
-
customFunctions
-
EMPTY_REGISTY
-
-
Constructor Details
-
MFDataModelFormatter
MFDataModelFormatter(MFDataModel.Message dm, Locale locale, MessageFormatter.ErrorHandlingBehavior errorHandlingBehavior, MessageFormatter.BidiIsolation bidiIsolation, MFFunctionRegistry customFunctionRegistry)
-
-
Method Details
-
format
-
implementBiDiDefault
private void implementBiDiDefault(StringBuilder result, Directionality msgdir, FormattedPlaceholder formattedExpression) -
findBestMatchingPattern
private MFDataModel.Pattern findBestMatchingPattern(MFDataModel.SelectMessage sm, MFDataModelFormatter.MapWithNfcKeys variables, MFDataModelFormatter.MapWithNfcKeys arguments) -
sortVariants
private static int sortVariants(MFDataModelFormatter.IntVarTuple o1, MFDataModelFormatter.IntVarTuple o2) -
matchSelectorKeys
spec: The method MatchSelectorKeys is determined by the implementation. It takes as arguments a resolved _selector_ value `rv` and a list of string keys `keys`, and returns a list of string keys in preferential order. The returned list MUST contain only unique elements of the input list `keys`. The returned list MAY be empty. The most-preferred key is first, with each successive key appearing in order by decreasing preference. -
fatalFormattingError
- Throws:
IllegalArgumentException
-
getFormattingFunctionFactoryByName
-
resolveLiteralOrVariable
private static Object resolveLiteralOrVariable(MFDataModel.LiteralOrVariableRef value, MFDataModelFormatter.MapWithNfcKeys localVars, MFDataModelFormatter.MapWithNfcKeys arguments) -
convertOptions
private static MFDataModelFormatter.MapWithNfcKeys convertOptions(Map<String, MFDataModel.Option> options, MFDataModelFormatter.MapWithNfcKeys localVars, MFDataModelFormatter.MapWithNfcKeys arguments) -
formatExpression
private FormattedPlaceholder formatExpression(MFDataModel.Expression expression, MFDataModelFormatter.MapWithNfcKeys variables, MFDataModelFormatter.MapWithNfcKeys arguments) Formats an expression.- Parameters:
expression
- the expression to formatvariables
- local variables, created from declarations (`.input` and `.local`)arguments
- the arguments passed at runtime to be formatted (`mf.format(arguments)`)
-
resolveDeclarations
private MFDataModelFormatter.MapWithNfcKeys resolveDeclarations(List<MFDataModel.Declaration> declarations, MFDataModelFormatter.MapWithNfcKeys arguments)
-