Java Code Examples for javax.json.JsonArray#iterator()

The following examples show how to use javax.json.JsonArray#iterator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonUnmarshaller.java    From karaf-decanter with Apache License 2.0 5 votes vote down vote up
private List<Object> build(JsonArray value) {
    List<Object> list = new ArrayList<>();
    Iterator<JsonValue> jsonValues = value.iterator();
    while (jsonValues.hasNext()) {
        JsonValue jsonValue = jsonValues.next();
        list.add(unmarshalAttribute(jsonValue));
    }
    return list;
}
 
Example 2
Source File: JSONConverter.java    From jcypher with Apache License 2.0 5 votes vote down vote up
/**
 * Build a recorded query from it's JSON representation
 * @param json
 * @return
 */
public RecordedQuery fromJSON(String json) {
	RecordedQuery ret = new RecordedQuery(false);
	StringReader sr = new StringReader(json);
	JsonReader reader = Json.createReader(sr);
	JsonObject jsonResult = reader.readObject();
	
	ret.setGeneric(jsonResult.getBoolean(GENERIC));
	JsonArray augmentations = jsonResult.getJsonArray(AUGMENTATIONS);
	if (augmentations != null) {
		Map<String, String> augs = new HashMap<String, String>();
		Iterator<JsonValue> ait = augmentations.iterator();
		while(ait.hasNext()) {
			JsonObject a = (JsonObject) ait.next();
			augs.put(a.getString(KEY), a.getString(VALUE));
		}
		ret.setAugmentations(augs);
	}
	
	JsonArray statements = jsonResult.getJsonArray(STATEMENTS);
	Iterator<JsonValue> it = statements.iterator();
	while(it.hasNext()) {
		JsonValue s = it.next();
		readStatement(s, ret.getStatements(), ret);
	}
	return ret;
}
 
Example 3
Source File: JSONContentHandler.java    From jcypher with Apache License 2.0 4 votes vote down vote up
public RowIterator() {
	super();
	JsonArray datas = getDataArray();
	this.jsonIterator = datas.iterator();
}