load
Loads a configuration of type T from the specified file.
This is a convenience overload that infers the KClass from the reified type parameter.
Example:
val config = YamlConfigManager.load<ServerConfig>(dataFolder.resolve("config.yml"))Return
The deserialized and validated configuration instance.
Since
1.0
Parameters
The configuration data class type.
The YAML file to load from. Created with defaults if it does not exist.
See also
Throws
If the config cannot be loaded and no default can be created.
Loads a configuration of type T from the specified file.
If the file does not exist, it is created with default values derived from T's primary constructor defaults. After loading, the config is validated, errors are reported via ConfigErrorFormatter, @Env overrides are applied, and the file is re-saved to fill in any missing fields.
Loading pipeline:
If the file does not exist, create it with defaults and return.
Read the YAML file into a raw map.
Run any registered ConfigMigrations if the file version is outdated.
Deserialize the map into an instance of T, collecting validation errors.
Report errors (if any) via the configured error formatter.
Save the instance back to normalize formatting and fill missing defaults.
Apply
@Envenvironment variable overrides to the in-memory instance.
Example:
val config = YamlConfigManager.load<ServerConfig>(dataFolder.resolve("config.yml"))Return
The deserialized and validated configuration instance.
Since
1.0
Parameters
The configuration data class type.
The YAML file to load from. Created with defaults if it does not exist.
The KClass of the configuration type.
See also
Throws
If the config cannot be loaded and no default can be created.