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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean@jakarta.validation.constraints.Min(0L) intGet the index of the argument formatted by this segment.protected abstract StringGet theMessageFormatpattern string argument suffix, if any.inthashCode()voidsetArgumentNumber(int argumentNumber) final StringEncode this segment as aMessageFormatpattern 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.SegmentEncode this segment as aMessageFormatpattern fragment.The concatenation of the encoding of the
MessageFmt.Segments in aMessageFmtproduces the correspondingMessageFormatpattern string.This method is responsible for escaping single quotes and opening curly braces, if necessary.
- Specified by:
toPatternin classMessageFmt.Segment- Returns:
MessageFormatpattern string text
-
getArgumentSuffix
Get theMessageFormatpattern 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:
equalsin classMessageFmt.Segment
-
hashCode
public int hashCode()- Overrides:
hashCodein classMessageFmt.Segment
-
toString
-