Class MessageFmt.ChoiceArgumentSegment

Enclosing class:
MessageFmt

public static class MessageFmt.ChoiceArgumentSegment extends MessageFmt.NumberFormatArgumentSegment<ChoiceFormat>
An MessageFmt.ArgumentSegment that formats its argument using a ChoiceFormat.

When a MessageFormat executes a nested ChoiceFormat, if the resulting string contains a '{' then the string is recursively interpreted again as a MessageFormat pattern. Therefore, the semantics of a ChoiceFormat differ when treated standalone vs. nested in a MessageFormat.

This class models the latter scenario. Each option of the choice is modeled as a new, nested MessageFormat (see MessageFmt.ChoiceArgumentSegment.Option) regardless of whether '{' appeared in the original pattern for the choice. This simplifies the model but also means that if the original choice pattern didn't contain '{', then the MessageFormat modeling that choice will have escaping applied to its format string, preserving the net effect.

See Also: