|
@@ -1,6 +1,7 @@
|
|
|
package me.lortseam.completeconfig.data;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.MoreCollectors;
|
|
|
import lombok.Getter;
|
|
|
import lombok.NonNull;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
@@ -14,7 +15,6 @@ import me.lortseam.completeconfig.data.structure.DataPart;
|
|
|
import me.lortseam.completeconfig.data.text.TranslationIdentifier;
|
|
|
import me.lortseam.completeconfig.exception.IllegalAnnotationParameterException;
|
|
|
import me.lortseam.completeconfig.extensions.CompleteConfigExtension;
|
|
|
-import me.lortseam.completeconfig.util.PropertyUtils;
|
|
|
import me.lortseam.completeconfig.util.TypeUtils;
|
|
|
import net.minecraft.text.Text;
|
|
|
import net.minecraft.text.TextColor;
|
|
@@ -23,6 +23,8 @@ import org.spongepowered.configurate.CommentedConfigurationNode;
|
|
|
import org.spongepowered.configurate.serialize.SerializationException;
|
|
|
|
|
|
import java.beans.IntrospectionException;
|
|
|
+import java.beans.Introspector;
|
|
|
+import java.beans.PropertyDescriptor;
|
|
|
import java.lang.reflect.*;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -152,7 +154,9 @@ public class Entry<T> implements DataPart {
|
|
|
|
|
|
private void set(T value) {
|
|
|
try {
|
|
|
- Optional<Method> writeMethod = PropertyUtils.getWriteMethod(field);
|
|
|
+ Optional<Method> writeMethod = Arrays.stream(Introspector.getBeanInfo(field.getDeclaringClass()).getPropertyDescriptors()).filter(property -> {
|
|
|
+ return property.getName().equals(field.getName());
|
|
|
+ }).collect(MoreCollectors.toOptional()).map(PropertyDescriptor::getWriteMethod);
|
|
|
if (writeMethod.isPresent()) {
|
|
|
writeMethod.get().invoke(isStatic() ? null : parentObject, value);
|
|
|
} else {
|