1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-22 01:48:50 +00:00

feat: 忽略内联字段

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-12-12 01:40:20 +08:00
parent f6b8aec813
commit 5fa3cad548

View File

@ -1,20 +1,21 @@
package pw.yumc.YumCore.config.inject; package pw.yumc.YumCore.config.inject;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.config.annotation.ConfigNode;
import pw.yumc.YumCore.config.annotation.Default;
import pw.yumc.YumCore.config.annotation.Nullable;
import pw.yumc.YumCore.config.annotation.ReadOnly;
import pw.yumc.YumCore.config.exception.ConfigParseException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.config.annotation.ConfigNode;
import pw.yumc.YumCore.config.annotation.Default;
import pw.yumc.YumCore.config.annotation.Nullable;
import pw.yumc.YumCore.config.annotation.ReadOnly;
import pw.yumc.YumCore.config.exception.ConfigParseException;
/** /**
* 抽象注入配置 * 抽象注入配置
* *
@ -156,7 +157,8 @@ public abstract class AbstractInjectConfig {
} }
this.config = config; this.config = config;
for (Field field : getClass().getDeclaredFields()) { for (Field field : getClass().getDeclaredFields()) {
if (Modifier.isTransient(field.getModifiers()) || field.getType().isPrimitive()) { // 忽略瞬态字段 忽略基础字段 忽略内联字段
if (Modifier.isTransient(field.getModifiers()) || field.getType().isPrimitive() || field.getName().startsWith("this$")) {
continue; continue;
} }
ConfigNode node = field.getAnnotation(ConfigNode.class); ConfigNode node = field.getAnnotation(ConfigNode.class);