Class MFFunctionRegistry
java.lang.Object
com.ibm.icu.message2.MFFunctionRegistry
Deprecated.
This API is for technology preview only.
This class is used to register mappings between various function
names and the factories that can create those functions.
For example to add formatting for a Person object one would need to:
- write a function (class, lambda, etc.) that does the formatting proper
(implementing
Function) - write a factory that creates such a function
(implementing
FunctionFactory) - add a mapping from the function name as used in the syntax
(for example
"person") to the factory - optionally add a mapping from the class to format (
...Person.class) to the function name ("person"), so that one can use a placeholder in the message without specifying a function (for example"... {$me} ..."instead of"... {$me :person} ...", if the class of$meis aninstanceof Person).
NOTE: all function names are normalized to NFC.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.This API is for technology preview only. -
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.private final Map<String, FunctionFactory> Deprecated. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDeprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic MFFunctionRegistry.Builderbuilder()Deprecated.This API is for technology preview only.getDefaultFunctionNameForType(Class<?> clazz) Deprecated.This API is for technology preview only.Deprecated.This API is for technology preview only.getFunction(String functionName) Deprecated.This API is for technology preview only.Deprecated.This API is for technology preview only.
-
Field Details
-
functionMap
Deprecated. -
classToFunction
-
-
Constructor Details
-
MFFunctionRegistry
Deprecated.
-
-
Method Details
-
builder
Deprecated.This API is for technology preview only.Creates a builder.- Returns:
- the Builder.
-
getFunction
Deprecated.This API is for technology preview only.Returns the function factory used to create the function namedname.Note: function name here means the name used to refer to the function in the MessageFormat 2 syntax, for example
"... {$exp :datetime} ..."
The function name here is"datetime", and does not have to correspond to the name of the methods / classes used to implement the functionality.For example one might write a
PersonFunctionFactoryreturning aPersonFunction, and map that to the MessageFormat function named"person".
The only name visible to the users of MessageFormat syntax will be"person".- Parameters:
functionName- the function name.- Returns:
- the factory creating function for
name. Returnsnullif none is registered.
-
getFunctionNames
Deprecated.This API is for technology preview only.Get all know names that have a mappings from name toFunctionFactory.- Returns:
- a set of all the known function names.
-
getDefaultFunctionNameForType
Deprecated.This API is for technology preview only.Returns the name of the function used to format an object of typeclazz.- Parameters:
clazz- the class of the object to format.- Returns:
- the name of the function class, if registered. Returns
nullotherwise.
-
getDefaultFunctionTypes
Deprecated.This API is for technology preview only.Get all know classes that have a mappings from class to function name.- Returns:
- a set of all the known classes that have mapping to function names.
-