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

public abstract static class MessageFmt.ArgumentSegment extends MessageFmt.Segment
A MessageFmt.Segment within a MessageFormat pattern that formats one of the arguments.
  • 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

      public final String toPattern()
      Description copied from class: MessageFmt.Segment
      Encode this segment as a MessageFormat pattern fragment.

      The concatenation of the encoding of the MessageFmt.Segments in a MessageFmt produces the corresponding MessageFormat pattern string.

      This method is responsible for escaping single quotes and opening curly braces, if necessary.

      Specified by:
      toPattern in class MessageFmt.Segment
      Returns:
      MessageFormat pattern string text
    • getArgumentSuffix

      protected abstract String getArgumentSuffix()
      Get the MessageFormat 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

      public boolean equals(Object obj)
      Overrides:
      equals in class MessageFmt.Segment
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class MessageFmt.Segment
    • toString

      public String toString()
      Overrides:
      toString in class Object