Package com.ibm.icu.message2
Class MFFunctionRegistry
- java.lang.Object
-
- com.ibm.icu.message2.MFFunctionRegistry
-
@Deprecated public class MFFunctionRegistry 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
MFFunctionRegistry.Builder
Deprecated.This API is for technology preview only.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Class<?>,java.lang.String>
classToFormatter
Deprecated.private java.util.Map<java.lang.String,FormatterFactory>
formattersMap
Deprecated.private java.util.Map<java.lang.String,SelectorFactory>
selectorsMap
Deprecated.
-
Constructor Summary
Constructors Modifier Constructor Description private
MFFunctionRegistry(MFFunctionRegistry.Builder builder)
Deprecated.
-
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.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.
-
-
-
Field Detail
-
formattersMap
private final java.util.Map<java.lang.String,FormatterFactory> formattersMap
Deprecated.
-
selectorsMap
private final java.util.Map<java.lang.String,SelectorFactory> selectorsMap
Deprecated.
-
classToFormatter
private final java.util.Map<java.lang.Class<?>,java.lang.String> classToFormatter
Deprecated.
-
-
Constructor Detail
-
MFFunctionRegistry
private MFFunctionRegistry(MFFunctionRegistry.Builder builder)
Deprecated.
-
-
Method Detail
-
builder
@Deprecated public static MFFunctionRegistry.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.
-
-