本文整理了Java中leap.lang.json.JSON.checkMissingProperties()
方法的一些代码示例,展示了JSON.checkMissingProperties()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.checkMissingProperties()
方法的具体详情如下:
包路径:leap.lang.json.JSON
类名称:JSON
方法名:checkMissingProperties
[英]Returns the missing properties exists in map but not exists in the given type.
[中]返回映射中存在但给定类型中不存在的缺少属性。
代码示例来源:origin: org.leapframework/leap-core
protected void checkMissingProperties(Class<?> type, Object source, Map<String, Object> map) {
Set<String> missingProperties = JSON.checkMissingProperties(type, map);
if (!missingProperties.isEmpty()) {
for (String p : missingProperties) {
if (p.equals("$") || p.endsWith(".$")) {
continue;
}
throw new IllegalStateException("Invalid property '" + missingProperties.iterator().next() +
"' at '" + source + "'");
}
}
}
代码示例来源:origin: org.leapframework/jmms-engine
protected final <T extends MetaObj> T decodeJsonMap(Map map, Class<T> type) {
if(map.isEmpty()) {
return null;
}
Set<String> missingProperties = JSON.checkMissingProperties(type, map);
if(!missingProperties.isEmpty()) {
for(String p : missingProperties) {
if(p.equals("$") || p.endsWith(".$")) {
continue;
}
throw new IllegalStateException("Invalid property '" + missingProperties.iterator().next() + "'");
}
}
return (T)Converts.toBean(map, type);
}
内容来源于网络,如有侵权,请联系作者删除!