Record Class TextArgument

java.lang.Object
java.lang.Record
nl.pim16aap2.animatedarchitecture.core.text.TextArgument
Record Components:
argument - The argument represented by this TextArgument. It is the value that will be used for variable substitution into the pattern String.
component - The optional text component to use for the text. This can be used to override the decorations of the surrounding text for the argument.

public record TextArgument(@Nullable Object argument, @Nullable TextComponent component) extends Record
Represents an argument in a piece of text.

For example given a String "Hello there, {0}", the TextArgument can be used to provide the substitution for "{0}".

  • Constructor Details

    • TextArgument

      public TextArgument(@Nullable @Nullable String text)
    • TextArgument

      public TextArgument(@Nullable @Nullable Object argument, @Nullable @Nullable TextComponent component)
      Creates an instance of a TextArgument record class.
      Parameters:
      argument - the value for the argument record component
      component - the value for the component record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • argument

      @Nullable public @Nullable Object argument()
      Returns the value of the argument record component.
      Returns:
      the value of the argument record component
    • component

      @Nullable public @Nullable TextComponent component()
      Returns the value of the component record component.
      Returns:
      the value of the component record component