Package com.ibm.icu.message2
Class Mf2FunctionRegistry
- java.lang.Object
-
- com.ibm.icu.message2.Mf2FunctionRegistry
-
@Deprecated public class Mf2FunctionRegistry extends java.lang.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
Formatter
) - write a factory that creates such a function
(implementing
FormatterFactory
) - 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 formatter 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
).
- write a function (class, lambda, etc.) that does the formatting proper
(implementing
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Mf2FunctionRegistry.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 Mf2FunctionRegistry.Builder
builder()
Deprecated.This API is for technology preview only.java.lang.String
getDefaultFormatterNameForType(java.lang.Class<?> clazz)
Deprecated.This API is for technology preview only.java.util.Set<java.lang.Class<?>>
getDefaultFormatterTypes()
Deprecated.This API is for technology preview only.FormatterFactory
getFormatter(java.lang.String formatterName)
Deprecated.This API is for technology preview only.java.util.Set<java.lang.String>
getFormatterNames()
Deprecated.This API is for technology preview only.SelectorFactory
getSelector(java.lang.String selectorName)
Deprecated.This API is for technology preview only.java.util.Set<java.lang.String>
getSelectorNames()
Deprecated.This API is for technology preview only.
-
-
-
Method Detail
-
builder
@Deprecated public static Mf2FunctionRegistry.Builder builder()
Deprecated.This API is for technology preview only.Creates a builder.- Returns:
- the Builder.
-
getFormatter
@Deprecated public FormatterFactory getFormatter(java.lang.String formatterName)
Deprecated.This API is for technology preview only.Returns the formatter factory used to create the formatter for 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
PersonFormatterFactory
returning aPersonFormatter
, and map that to the MessageFormat function named"person"
.
The only name visible to the users of MessageFormat syntax will be"person"
.- Parameters:
formatterName
- the function name.- Returns:
- the factory creating formatters for
name
. Returnsnull
if none is registered.
-
getFormatterNames
@Deprecated public java.util.Set<java.lang.String> getFormatterNames()
Deprecated.This API is for technology preview only.Get all know names that have a mappings from name toFormatterFactory
.- Returns:
- a set of all the known formatter names.
-
getDefaultFormatterNameForType
@Deprecated public java.lang.String getDefaultFormatterNameForType(java.lang.Class<?> clazz)
Deprecated.This API is for technology preview only.Returns the name of the formatter used to format an object of typeclazz
.- Parameters:
clazz
- the class of the object to format.- Returns:
- the name of the formatter class, if registered. Returns
null
otherwise.
-
getDefaultFormatterTypes
@Deprecated public java.util.Set<java.lang.Class<?>> getDefaultFormatterTypes()
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.
-
getSelector
@Deprecated public SelectorFactory getSelector(java.lang.String selectorName)
Deprecated.This API is for technology preview only.Returns the selector factory used to create the selector for function namedname
.Note: the same comments about naming as the ones on
getFormatter
apply.- Parameters:
selectorName
- the selector name.- Returns:
- the factory creating selectors for
name
. Returnsnull
if none is registered. - See Also:
getFormatter(String)
-
getSelectorNames
@Deprecated public java.util.Set<java.lang.String> getSelectorNames()
Deprecated.This API is for technology preview only.Get all know names that have a mappings from name toSelectorFactory
.- Returns:
- a set of all the known selector names.
-
-