本文整理汇总了Java中org.json.simple.JSONObject.entrySet方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.entrySet方法的具体用法?Java JSONObject.entrySet怎么用?Java JSONObject.entrySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.json.simple.JSONObject
的用法示例。
在下文中一共展示了JSONObject.entrySet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Marker
import org.json.simple.JSONObject; //导入方法依赖的package包/类
private Marker(Tool tool, JSONObject object) {
this.tool = tool;
content = new TreeMap<>();
// This loop is necessary to make the type checker to shut up.
for (Object e : object.entrySet()) {
Map.Entry entry = (Map.Entry) e;
content.put(String.valueOf(entry.getKey()), entry.getValue());
}
}
示例2: AlvisAEAnnotation
import org.json.simple.JSONObject; //导入方法依赖的package包/类
protected AlvisAEAnnotation(AnnotationSet annotationSet, JSONObject jAnnot) {
this(annotationSet, (String) jAnnot.get("id"), (String) jAnnot.get("type"));
JSONObject jProps = (JSONObject) jAnnot.get("properties");
for (Object o : jProps.entrySet()) {
@SuppressWarnings("rawtypes")
Map.Entry e = (Map.Entry) o;
String key = (String) e.getKey();
JSONArray values = (JSONArray) e.getValue();
for (Object v : values)
addProperty(key, v);
}
if (jAnnot.containsKey("sources")) {
JSONArray jSources = (JSONArray) jAnnot.get("sources");
// System.err.println("jSources = " + jSources);
sources.load(jSources);
}
}
示例3: apply
import org.json.simple.JSONObject; //导入方法依赖的package包/类
@Override
public JSONObject apply(final JSONObject a, final JSONObject b) {
for (final Map.Entry entry : (Set<Map.Entry>) b.entrySet()) {
if (entry.getValue() instanceof JSONObject) {
if (a.containsKey(entry.getKey())) {
final Object object = a.get(entry.getKey());
if (object instanceof JSONArray) {
final JSONObject other = findById((JSONArray) object, ((JSONObject) entry.getValue()));
if (null == other)
((JSONArray) object).add(format((JSONObject) entry.getValue()));
else
apply(other, (JSONObject) entry.getValue());
} else {
final JSONArray array = new JSONArray();
array.add(object);
array.add(format((JSONObject) entry.getValue()));
a.put(entry.getKey(), array);
}
} else
a.put(entry.getKey(), format((JSONObject) entry.getValue()));
} else if (entry.getValue() instanceof List)
a.put(entry.getKey(),
((List) entry.getValue()).size() == 1 ?
((List) entry.getValue()).get(0) : entry.getValue());
else
a.put(entry.getKey(), entry.getValue());
}
return a;
}
示例4: toXML
import org.json.simple.JSONObject; //导入方法依赖的package包/类
public static Element toXML(Document doc, JSONObject object) {
Element result = doc.createElement("object");
for (Object o : object.entrySet()) {
@SuppressWarnings("unchecked")
Map.Entry<String,Object> e = (Map.Entry<String,Object>) o;
Element pair = doc.createElement("pair");
pair.setAttribute("key", e.getKey());
pair.appendChild(toXML(doc, e.getValue()));
result.appendChild(pair);
}
return result;
}
示例5: loadJSON
import org.json.simple.JSONObject; //导入方法依赖的package包/类
public void loadJSON(JSONObject json) {
for (Object o : json.entrySet()) {
Map.Entry e = (Map.Entry) o;
String key = (String) e.getKey();
JSONArray values = (JSONArray) e.getValue();
setProperty(key, values);
}
}
示例6: Relation
import org.json.simple.JSONObject; //导入方法依赖的package包/类
public Relation(AlvisAEAnnotationSet annotationSet, JSONObject json) {
super(annotationSet, json);
JSONObject r = (JSONObject) json.get("relation");
for (Object o : r.entrySet()) {
@SuppressWarnings("rawtypes")
Map.Entry e = (Entry) o;
String role = (String) e.getKey();
JSONObject arg = (JSONObject) e.getValue();
AlvisAEAnnotation a = annotationSet.getAnnotationByID(arg);
if (a != null)
setArgument(role, a);
}
annotationSet.addRelation(this);
}
示例7: Relation
import org.json.simple.JSONObject; //导入方法依赖的package包/类
Relation(AnnotationSet annotationSet, JSONObject jRel) {
super(annotationSet, jRel);
JSONObject args = (JSONObject) jRel.get("relation");
for (Object o : args.entrySet()) {
@SuppressWarnings("rawtypes")
Map.Entry e = (Entry) o;
JSONObject ref = (JSONObject) e.getValue();
setArgument((String) e.getKey(), (String) ref.get("ann_id"));
}
annotationSet.addRelation(this);
}