mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-21 01:38:51 +00:00
feat: 添加数据类型检测提示
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
b307dcbb62
commit
cb1cb7f492
@ -121,6 +121,9 @@ public abstract class AbstractInjectConfig {
|
||||
if (type.equals(String.class)) {
|
||||
value = ChatColor.translateAlternateColorCodes('&', String.valueOf(value));
|
||||
}
|
||||
if (value != null && !type.isAssignableFrom(value.getClass())) {
|
||||
Log.w("字段 %s 默认类型为 %s 但解析后为 %s 可能存在转换错误!", field.getName(), type.getName(), value.getClass().getName());
|
||||
}
|
||||
field.set(this, value);
|
||||
Log.d("设置字段 %s 为 %s ", field.getName(), value);
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
package pw.yumc.YumCore.config.inject;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import pw.yumc.YumCore.config.exception.ConfigParseException;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -11,6 +8,10 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import pw.yumc.YumCore.config.exception.ConfigParseException;
|
||||
|
||||
/**
|
||||
* 注入配置类解析
|
||||
*
|
||||
@ -66,6 +67,7 @@ public class InjectParse {
|
||||
public static class DateFormatParse implements Parse<DateFormat> {
|
||||
public DateFormatParse() {
|
||||
allparse.put(DateFormat.class, this);
|
||||
allparse.put(SimpleDateFormat.class, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user