本文整理了Java中org.apache.storm.utils.Utils.normalizeConf()
方法的一些代码示例,展示了Utils.normalizeConf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.normalizeConf()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:normalizeConf
暂无
代码示例来源:origin: apache/storm
@SuppressWarnings("unchecked")
private static Object normalizeConfValue(Object obj) {
if (obj instanceof Map) {
return normalizeConf((Map<String, Object>) obj);
} else if (obj instanceof Collection) {
List<Object> confList = new ArrayList<>((Collection<Object>) obj);
for (int i = 0; i < confList.size(); i++) {
Object val = confList.get(i);
confList.set(i, normalizeConfValue(val));
}
return confList;
} else if (obj instanceof Integer) {
return ((Number) obj).longValue();
} else if (obj instanceof Float) {
return ((Float) obj).doubleValue();
} else {
return obj;
}
}
代码示例来源:origin: apache/storm
@SuppressWarnings("unchecked")
public static boolean isValidConf(Map<String, Object> topoConfIn) {
Map<String, Object> origTopoConf = normalizeConf(topoConfIn);
try {
Map<String, Object> deserTopoConf = normalizeConf(
(Map<String, Object>) JSONValue.parseWithException(JSONValue.toJSONString(topoConfIn)));
return isValidConf(origTopoConf, deserTopoConf);
} catch (ParseException e) {
LOG.error("Json serialized config could not be deserialized", e);
}
return false;
}
代码示例来源:origin: org.apache.storm/storm-core
public static boolean isValidConf(Map<String, Object> stormConf) {
return normalizeConf(stormConf).equals(normalizeConf((Map) JSONValue.parse(JSONValue.toJSONString(stormConf))));
}
代码示例来源:origin: org.apache.storm/storm-core
private static Object normalizeConf(Object conf) {
if (conf == null) return new HashMap();
if (conf instanceof Map) {
Map<Object, Object> confMap = new HashMap((Map) conf);
for (Map.Entry<Object, Object> entry : confMap.entrySet()) {
confMap.put(entry.getKey(), normalizeConf(entry.getValue()));
}
return confMap;
} else if (conf instanceof List) {
List confList = new ArrayList((List) conf);
for (int i = 0; i < confList.size(); i++) {
Object val = confList.get(i);
confList.set(i, normalizeConf(val));
}
return confList;
} else if (conf instanceof Integer) {
return ((Integer) conf).longValue();
} else if (conf instanceof Float) {
return ((Float) conf).doubleValue();
} else {
return conf;
}
}
内容来源于网络,如有侵权,请联系作者删除!