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

feat: 添加注入配置的Null检测

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-09-10 00:44:27 +08:00
parent 2a37a88bfe
commit 4c8cd290b5

View File

@ -28,6 +28,10 @@ public abstract class AbstractInjectConfig {
* 注入配置数据 * 注入配置数据
*/ */
public void inject(final ConfigurationSection config) { public void inject(final ConfigurationSection config) {
if (config == null) {
Log.warning("尝试注入 ConfigurationSection 为 Null 的数据!");
return;
}
this.config = config; this.config = config;
for (final Field field : getClass().getDeclaredFields()) { for (final Field field : getClass().getDeclaredFields()) {
if (Modifier.isTransient(field.getModifiers()) || field.getType().isPrimitive()) { if (Modifier.isTransient(field.getModifiers()) || field.getType().isPrimitive()) {