Package com.ibm.icu.message2
Class MessageFormatter.Builder
- java.lang.Object
-
- com.ibm.icu.message2.MessageFormatter.Builder
-
- Enclosing class:
- MessageFormatter
public static class MessageFormatter.Builder extends Object
ABuilder
used to build instances ofMessageFormatter
.- Status:
- Draft ICU 78.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MessageFormatter
build()
Builds an instance ofMessageFormatter
.MessageFormatter.Builder
setBidiIsolation(MessageFormatter.BidiIsolation bidiIsolation)
Sets theMessageFormatter.BidiIsolation
to introduce bidi control characters / tags as described in the MessageFormat 2 specification.MessageFormatter.Builder
setDataModel(MFDataModel.Message dataModel)
Deprecated.This API is for technology preview only.MessageFormatter.Builder
setErrorHandlingBehavior(MessageFormatter.ErrorHandlingBehavior errorHandlingBehavior)
Sets theMessageFormatter.ErrorHandlingBehavior
to use when encountering errors at formatting time.MessageFormatter.Builder
setFunctionRegistry(MFFunctionRegistry functionRegistry)
Deprecated.This API is for technology preview only.MessageFormatter.Builder
setLocale(Locale locale)
Sets the locale to use for all formatting and selection operations.MessageFormatter.Builder
setPattern(String pattern)
Sets the pattern (in MessageFormat 2 syntax) used to create the message.
It conflicts with the data model, so it will reset it (the last call on setter wins).
-
-
-
Method Detail
-
setLocale
public MessageFormatter.Builder setLocale(Locale locale)
Sets the locale to use for all formatting and selection operations.- Parameters:
locale
- the locale to set.- Returns:
- the builder, for fluent use.
- Status:
- Draft ICU 78.
-
setPattern
public MessageFormatter.Builder setPattern(String pattern)
Sets the pattern (in MessageFormat 2 syntax) used to create the message.
It conflicts with the data model, so it will reset it (the last call on setter wins).- Parameters:
pattern
- the pattern to set.- Returns:
- the builder, for fluent use.
- Status:
- Draft ICU 78.
-
setErrorHandlingBehavior
public MessageFormatter.Builder setErrorHandlingBehavior(MessageFormatter.ErrorHandlingBehavior errorHandlingBehavior)
Sets theMessageFormatter.ErrorHandlingBehavior
to use when encountering errors at formatting time.The default value is
ErrorHandlingBehavior.BEST_EFFORT
, trying to fallback.- Parameters:
errorHandlingBehavior
- the error handling behavior to use.- Returns:
- the builder, for fluent use.
- Status:
- Draft ICU 78.
-
setBidiIsolation
public MessageFormatter.Builder setBidiIsolation(MessageFormatter.BidiIsolation bidiIsolation)
Sets theMessageFormatter.BidiIsolation
to introduce bidi control characters / tags as described in the MessageFormat 2 specification.The default value is
BidiIsolation.NONE
.- Parameters:
bidiIsolation
- the bidi isolation algorithm to use.- Returns:
- the builder, for fluent use.
- Status:
- Draft ICU 78.
-
setFunctionRegistry
@Deprecated public MessageFormatter.Builder setFunctionRegistry(MFFunctionRegistry functionRegistry)
Deprecated.This API is for technology preview only.Sets an instance ofMFFunctionRegistry
that should register any custom functions used by the message.There is no need to do this in order to use standard functions (for example date / time / number formatting, plural / ordinal / literal selection).
The exact set of standard functions, with the types they format and the options they accept is still TBD.- Parameters:
functionRegistry
- the function registry to set.- Returns:
- the builder, for fluent use.
- Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
setDataModel
@Deprecated public MessageFormatter.Builder setDataModel(MFDataModel.Message dataModel)
Deprecated.This API is for technology preview only.Sets the data model used to create the message.
It conflicts with the pattern, so it will reset it (the last call on setter wins).- Parameters:
dataModel
- the pattern to set.- Returns:
- the builder, for fluent use.
- Status:
- Technology Preview. This API is still in the early stages of development. Use at your own risk.
-
build
public MessageFormatter build()
Builds an instance ofMessageFormatter
.- Returns:
- the
MessageFormatter
created. - Status:
- Draft ICU 78.
-
-