Class ValidConstantRecord

java.lang.Object
com.winterhavenmc.library.messagebuilder.model.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(RecordKey, Object) static factory method.

See Also:
  • Method Details

    • create

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

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

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

      public RecordKey key()
      Specified by:
      key in interface SectionRecord
    • 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 String, 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