Package com.winterhavenmc.library.messagebuilder.model.language
package com.winterhavenmc.library.messagebuilder.model.language
Provides interfaces and data models that represent entries from the plugin's
language YAML file. These records abstract the three top-level sections of the
file:
MESSAGES
, ITEMS
, and CONSTANTS
.
Overview
Each section is represented by a sealed interface:
These interfaces have two core implementations:- Valid record types (e.g.,
ValidMessageRecord
) that contain fully parsed, structured data - Invalid record types (e.g.,
InvalidItemRecord
) that represent missing or invalid entries
The use of sealed interfaces ensures that all variants are accounted for and safely handled throughout the MessageBuilder pipeline.
Design Notes
- All types follow the data-driven design pattern: validation occurs at construction time.
- Factory methods such as
from(...)
are used to ensure all instances are safe and complete. RecordKey
is used as a strongly typed identifier across all sections.
Typical Usage
ItemRecord itemRecord = queryHandler.getItemRecord(MY_ITEM_KEY);
if (itemRecord instanceof ValidItemRecord valid) {
String name = valid.nameSingular();
}
- See Also:
-
ClassDescriptionA sealed interface representing a key–value pair loaded from the
CONSTANTS
section of a language YAML file.AMessageRecord
representing a fully constructed, macro-resolved message ready for delivery to a recipient.AConstantRecord
representing a missing or invalid constant from theCONSTANTS
section of a language YAML file.AnItemRecord
representing a missing or invalid item entry from theITEMS
section of a language YAML file.AMessageRecord
representing a missing or invalid entry from theMESSAGES
section of a language file.A sealed interface representing a record loaded from theITEMS
section of a language YAML file.Enumeration of field keys within anItemRecord
, mapping enum constants to their corresponding YAML key paths.A sealed interface representing a structured message record loaded from theMESSAGES
section of a language YAML file.Enum representing the fields defined in aValidMessageRecord
.An enumeration of Sections that correspond directly to each top levelConfigurationSection
of the language file.A sealed interface representing a validated record loaded from a structured section of a language YAML file.A validated, immutableConstantRecord
representing a constant value loaded from theCONSTANTS
section of a language YAML file.A validated, immutableItemRecord
representing a localized or macro-enabled item definition loaded from theITEMS
section of a language YAML file.A validated, immutableMessageRecord
representing a single entry from theMESSAGES
section of a language YAML file.