Class ValidConstantRecord
java.lang.Object
com.winterhavenmc.library.messagebuilder.model.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(RecordKey, Object)
static factory method.
- See Also:
-
Method Summary
-
Method Details
-
create
Creates aValidConstantRecord
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 keyvalue
- the raw value from the YAML configuration- Returns:
- a validated constant record instance
-
key
- Specified by:
key
in interfaceSectionRecord
-
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
, orBoolean
.- Returns:
- the constant value
-
equals
-
hashCode
public int hashCode()
-