Package com.ibm.icu.message2
Class MFFunctionRegistry
- java.lang.Object
-
- com.ibm.icu.message2.MFFunctionRegistry
-
@Deprecated public class MFFunctionRegistry extends Object
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$me
is 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.
- write a function (class, lambda, etc.) that does the formatting proper
(implementing
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MFFunctionRegistry.Builder
Deprecated.This API is for technology preview only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static MFFunctionRegistry.Builder
builder()
Deprecated.This API is for technology preview only.String
getDefaultFunctionNameForType(Class<?> clazz)
Deprecated.This API is for technology preview only.Set<Class<?>>
getDefaultFunctionTypes()
Deprecated.This API is for technology preview only.FunctionFactory
getFunction(String functionName)
Deprecated.This API is for technology preview only.Set<String>
getFunctionNames()
Deprecated.This API is for technology preview only.
-
-
-
Method Detail
-
builder
@Deprecated public static MFFunctionRegistry.Builder 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.
-
getFunction
@Deprecated public FunctionFactory getFunction(String functionName)
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
PersonFunctionFactory
returning 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
. Returnsnull
if none is registered. - Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
getFunctionNames
@Deprecated public Set<String> 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 public String getDefaultFunctionNameForType(Class<?> clazz)
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
null
otherwise. - Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
getDefaultFunctionTypes
@Deprecated public Set<Class<?>> 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.
-
-