Package org.dellroad.stuff.text
Class MessageFmt.ArgumentSegment
java.lang.Object
org.dellroad.stuff.text.MessageFmt.Segment
org.dellroad.stuff.text.MessageFmt.ArgumentSegment
- Direct Known Subclasses:
MessageFmt.DefaultArgumentSegment
,MessageFmt.FormatArgumentSegment
- Enclosing class:
- MessageFmt
A
MessageFmt.Segment
within a MessageFormat
pattern that formats one of the arguments.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
@jakarta.validation.constraints.Min(0L) int
Get the index of the argument formatted by this segment.protected abstract String
Get theMessageFormat
pattern string argument suffix, if any.int
hashCode()
void
setArgumentNumber
(int argumentNumber) final String
Encode this segment as aMessageFormat
pattern fragment.toString()
Methods inherited from class org.dellroad.stuff.text.MessageFmt.Segment
visit
-
Constructor Details
-
ArgumentSegment
protected ArgumentSegment() -
ArgumentSegment
protected ArgumentSegment(int argumentNumber)
-
-
Method Details
-
getArgumentNumber
@Min(0L) public @jakarta.validation.constraints.Min(0L) int getArgumentNumber()Get the index of the argument formatted by this segment.- Returns:
- argument to format, zero-based
-
setArgumentNumber
public void setArgumentNumber(int argumentNumber) -
toPattern
Description copied from class:MessageFmt.Segment
Encode this segment as aMessageFormat
pattern fragment.The concatenation of the encoding of the
MessageFmt.Segment
s in aMessageFmt
produces the correspondingMessageFormat
pattern string.This method is responsible for escaping single quotes and opening curly braces, if necessary.
- Specified by:
toPattern
in classMessageFmt.Segment
- Returns:
MessageFormat
pattern string text
-
getArgumentSuffix
Get theMessageFormat
pattern string argument suffix, if any.If present, this suffix follows the argument number and a comma, and precedes the closing curly brace.
Used by
toPattern()
.- Returns:
- pattern string argument suffix, or null if none needed
-
equals
- Overrides:
equals
in classMessageFmt.Segment
-
hashCode
public int hashCode()- Overrides:
hashCode
in classMessageFmt.Segment
-
toString
-