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 classprivate static class(package private) static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MessageFormatter.BidiIsolationprivate final MFFunctionRegistryprivate final MFDataModel.Messageprivate static final MFFunctionRegistryprivate final MessageFormatter.ErrorHandlingBehaviorprivate static final charprivate final Localeprivate static final charprivate static final charprivate static final charprivate 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.MapWithNfcKeysconvertOptions(Map<String, MFDataModel.Option> options, MFDataModelFormatter.MapWithNfcKeys localVars, MFDataModelFormatter.MapWithNfcKeys arguments) private static voidfatalFormattingError(String message) private MFDataModel.PatternfindBestMatchingPattern(MFDataModel.SelectMessage sm, MFDataModelFormatter.MapWithNfcKeys variables, MFDataModelFormatter.MapWithNfcKeys arguments) (package private) Stringprivate FormattedPlaceholderformatExpression(MFDataModel.Expression expression, MFDataModelFormatter.MapWithNfcKeys variables, MFDataModelFormatter.MapWithNfcKeys arguments) Formats an expression.private FunctionFactorygetFormattingFunctionFactoryByName(Object toFormat, String functionName) private voidimplementBiDiDefault(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 ObjectresolveLiteralOrVariable(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)
-