java.lang.Object
com.winterhavenmc.library.messagebuilder.models.language.ValidConstantRecord
All Implemented Interfaces:
ConstantRecord, SectionRecord

public final class ValidConstantRecord extends Object implements ConstantRecord
A validated, immutable ConstantRecord representing a constant value loaded from the CONSTANTS section of a language YAML file.

A constant may represent a string, number, boolean, or other supported type. These values are typically referenced using macros in messages (e.g. %SERVER_NAME%).

This record is considered safe and complete once constructed, and is created via the create(ValidConstantKey, Object) static factory method.

See Also:
  • Method Details

    • create

      public static ValidConstantRecord create(ValidConstantKey key, Object value)
      Creates a ValidConstantRecord from the provided string and value.

      This method should be called only after validation, typically from ConstantRecord.of(ValidConstantKey, Object).

      Parameters:
      key - the unique constant string
      value - the raw value from the YAML configuration
      Returns:
      a validated constant record instance
    • key

      public ValidConstantKey key()
      Returns the valid key associated with this record.
      Specified by:
      key in interface SectionRecord
      Returns:
      The valid constant key for this record.
    • value

      public Object value()
      Returns the raw constant value associated with this record.

      The type may vary depending on what was stored in the language configuration. It is typically expected to be a Section, Number, or Boolean.

      Returns:
      the constant value
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object