-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
I'm trying to use ObjectDeserializer to deserialize my config into a Record, but I get the following exception:
com.electronwill.nightconfig.core.serde.SerdeException: Could not deserialize this configuration to a record of type class com.example.config.ServerConfigData because the following components (entries) are missing: switchInterval
ServerConfigData is defined as follows:
public record ServerConfigData(
@SerdeKey("switch_interval")
@SerdeComment("A comment")
int switchInterval,
@SerdeComment("First comment")
@SerdeComment("Second comment")
Map<String, List<UUID>> groups
)It seems that the @SerdeKey annotations are not respected during deserialization.
Am I doing something wrong or is that a genuine bug?
Currently I'm reading the config as follows:
public final class ConfigManager {
private CommentedFileConfig serverConfig;
public ConfigManager() {
Path configDir = null; // Some path
serverConfig = CommentedFileConfig
.builder(configDir.resolve("server_config.toml"))
.defaultResource("/config/default_server_config.toml")
.preserveInsertionOrder()
.autoreload()
.build();
serverConfig.load();
}
public ServerConfigData getServerConfig() {
return ObjectDeserializer.standard().deserializeToRecord(serverConfig, ServerConfigData.class);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels