java.lang.Object
com.winterhavenmc.library.messagebuilder.models.keys.ValidMacroKey
All Implemented Interfaces:
MacroKey, StandardKey

public final class ValidMacroKey extends Object implements MacroKey
A type that represents a validated string for a macro. This type guarantees a valid string that has been validated upon creation. The static factory methods return an Optional of the LegacyRecordKey, or an empty Optional if the parameter was invalid, as determined by regex pattern and Predicate.
  • Method Details

    • append

      public MacroKey append(String subKey)
      Create a new string by suffixing a dot-separated subkey to this existing string
      Parameters:
      subKey - a string to be used for the appended subkey
      Returns:
      a new string with the subkey appended, or an empty Optional if the string was not a valid string
    • append

      public <E extends Enum<E>> MacroKey append(E subKey)
      Create a new string by suffixing a dot-separated subkey to this existing string
      Type Parameters:
      E - an enum constant
      Parameters:
      subKey - an enu constant whose name() is to be used for the appended subkey
      Returns:
      a new string with the subkey appended, or an empty Optional if the string was not a valid string
    • getBase

      public ValidMacroKey getBase()
    • asPlaceholder

      public String asPlaceholder()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object