本文整理匯總了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);
}