public <T> T get(final Entry<T> entry) {
final Configuration configuration = getStore().getConfigurationStore().get();
final Object value = configuration.get(entry.getPath(), entry.getDefault());
if (value == null) {
return entry.getDefault();
} else if (entry.getDefault().getClass().equals(value.getClass())) {
return (T) entry.getDefault().getClass().cast(value);
} else {
log.warn(String.format("Configuration entry [%s] of class [%s] did not match the returned class of [%s]!", entry.getPath(), entry.getDefault().getClass().getSimpleName(), value.getClass().getSimpleName()));
log.warn(String.format("To prevent errors for configuration entry [%s] the default value [%s] will be returned!", entry.getPath(), entry.getDefault()));
return entry.getDefault();
}
}
ConfigurationService.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:Reporter
作者:
评论列表
文章目录