From 82cfa0612e64169302558e7191af9b638473111c Mon Sep 17 00:00:00 2001 From: Silthus Date: Sat, 19 Dec 2020 23:07:07 +0100 Subject: [PATCH] fix: convert object to primitive type if needed --- .../main/java/net/silthus/configmapper/DefaultConfigMap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/net/silthus/configmapper/DefaultConfigMap.java b/core/src/main/java/net/silthus/configmapper/DefaultConfigMap.java index 8d62a07..ccd7bff 100644 --- a/core/src/main/java/net/silthus/configmapper/DefaultConfigMap.java +++ b/core/src/main/java/net/silthus/configmapper/DefaultConfigMap.java @@ -98,7 +98,7 @@ private void setConfigField(Object config, ConfigFieldInformation fieldInformati } else { Field field = config.getClass().getDeclaredField(fieldInformation.name()); field.setAccessible(true); - field.set(config, fieldInformation.type().cast(value)); + field.set(config, ReflectionUtil.toObject(fieldInformation.type(), value)); } } catch (Exception e) { e.printStackTrace();