Class ValidConstantRecord
java.lang.Object
com.winterhavenmc.library.messagebuilder.models.language.ValidConstantRecord
- All Implemented Interfaces:
ConstantRecord,SectionRecord
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 Summary
Modifier and TypeMethodDescriptionstatic ValidConstantRecordcreate(ValidConstantKey key, Object value) Creates aValidConstantRecordfrom the provided string and value.booleaninthashCode()key()Returns the valid key associated with this record.value()Returns the raw constant value associated with this record.
-
Method Details
-
create
Creates aValidConstantRecordfrom the provided string and value.This method should be called only after validation, typically from
ConstantRecord.of(ValidConstantKey, Object).- Parameters:
key- the unique constant stringvalue- the raw value from the YAML configuration- Returns:
- a validated constant record instance
-
key
Returns the valid key associated with this record.- Specified by:
keyin interfaceSectionRecord- Returns:
- The valid constant key for this record.
-
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, orBoolean.- Returns:
- the constant value
-
equals
-
hashCode
public int hashCode()
-