Package org.dellroad.stuff.text
Class MessageFmt.FormatArgumentSegment<T extends Format>
java.lang.Object
org.dellroad.stuff.text.MessageFmt.Segment
org.dellroad.stuff.text.MessageFmt.ArgumentSegment
org.dellroad.stuff.text.MessageFmt.FormatArgumentSegment<T>
- Type Parameters:
T- type ofFormatused to format the argument
- Direct Known Subclasses:
MessageFmt.DateFormatArgumentSegment,MessageFmt.NumberFormatArgumentSegment
- Enclosing class:
- MessageFmt
public abstract static class MessageFmt.FormatArgumentSegment<T extends Format>
extends MessageFmt.ArgumentSegment
An
MessageFmt.ArgumentSegment that formats its argument using a Format of some kind.
Use FormatArgumentSegment.of() to produce a concrete instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Format>
MessageFmt.FormatArgumentSegment<T>Map the given argumentFormatinto the correspondingMessageFmt.ArgumentSegment.Methods inherited from class org.dellroad.stuff.text.MessageFmt.ArgumentSegment
equals, getArgumentNumber, getArgumentSuffix, hashCode, setArgumentNumber, toPattern, toStringMethods inherited from class org.dellroad.stuff.text.MessageFmt.Segment
visit
-
Constructor Details
-
FormatArgumentSegment
protected FormatArgumentSegment() -
FormatArgumentSegment
protected FormatArgumentSegment(int argumentNumber)
-
-
Method Details
-
of
public static <T extends Format> MessageFmt.FormatArgumentSegment<T> of(T format, int argumentNumber, Locale locale) Map the given argumentFormatinto the correspondingMessageFmt.ArgumentSegment.The optional
localeparameter allows for identification of certain formats when they equal the locale default. This also results in more conciseMessageFormatformat strings (seeMessageFmt.toPattern()), but makes the result implicitly depend on theLocalebeing used (because differentLocales have different defaults for integer, percent, currency, etc).- Type Parameters:
T- format type- Parameters:
format- format to be used for argumentargumentNumber- argument numberlocale- assumed locale, or null to not make any locale assumptions- Returns:
- an equivalent
MessageFmt.FormatArgumentSegment - Throws:
IllegalArgumentException- ifargumentNumberis negativeIllegalArgumentException- ifformatis null or cannot be deciphered
-