Class MFFunctionRegistry
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.
- Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.This API is for technology preview only. -
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.static MFFunctionRegistryDeprecated.This API is for technology preview only.
-
Method Details
-
builder
Deprecated.This API is for technology preview only.Creates a builder.- Returns:
- the Builder.
- Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
getStandardFunctionsRegistry
Deprecated.This API is for technology preview only.Returns an immutable MFFunctionRegistry that gives access to the standard functions.This is useful for implementers of custom functions wanting to reproduce the behavior of the standard functions without re-implementing everything. They might need to "tinker" with input and options, chain to the original implementation, and then "tinker" with the result.
- Returns:
- a MFFunctionRegistry that contains the standard functions
- Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
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. - Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
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.
- Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
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. - Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
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.
- Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-