Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonNode.elements()


    InputStream stream = resource.getInputStream();
    JsonNode node = mapper.reader(JsonNode.class).readTree(stream);

    if (node.isArray()) {

      Iterator<JsonNode> elements = node.elements();
      List<Object> result = new ArrayList<Object>();

      while (elements.hasNext()) {
        JsonNode element = elements.next();
        result.add(readSingle(element, classLoader));
View Full Code Here


                            DeserializationContext deserializationContext) throws IOException, JsonProcessingException {

        ObjectCodec oc = jsonParser.getCodec();
        JsonNode node = oc.readTree(jsonParser);
        String rel = node.fieldNames().next();
        String href = node.elements().next().get("href").textValue();


        return new Link(rel,href);
    }
}
View Full Code Here

            List eventArgs = new ArrayList();
            Event event = new Event(eventName, eventArgs);
            JsonNode args = root.get("args");
            if (args != null) {
                Iterator<JsonNode> iterator = args.elements();
                if (iterator.hasNext()) {
                    JsonNode node = iterator.next();
                    Class<?> eventClass = eventMapping.get(eventName);
                    Object arg = mapper.treeToValue(node, eventClass);
                    eventArgs.add(arg);
View Full Code Here

            principal = mapOfPrincipals.next();
            schema = principal.getKey();
            principalNode = principal.getValue();

            if (principalNode.isArray()) {
                elements = principalNode.elements();
                while (elements.hasNext()) {
                    principals.add(createPrincipal(schema, elements.next()));
                }
            } else {
                principals.add(createPrincipal(schema, principalNode));
View Full Code Here

            values = new LinkedList<String>();
            field = mapOfFields.next();
            fieldValue = field.getValue();

            if (fieldValue.isArray()) {
                elements = fieldValue.elements();
                while (elements.hasNext()) {
                    values.add(elements.next().asText());
                }
            } else {
                values.add(fieldValue.asText());
View Full Code Here

        }
        Element element = document.createElementNS(ns, name);

        JsonNode attributesNode = jsonNode.get("attributes");
        if (attributesNode != null && attributesNode instanceof ArrayNode) {
            Iterator<JsonNode> atts = attributesNode.elements();
            while (atts.hasNext()) {
                JsonNode node = atts.next();
                ns = node.get("namespace") != null ? node.get("namespace").asText() : null;
                name = node.get("name") != null ? node.get("name").asText() : null;
                String value = node.get("$") != null ? node.get("$").asText() : null;
View Full Code Here

            }
        }

        JsonNode childsNode = jsonNode.get("children");
        if (childsNode != null && childsNode instanceof ArrayNode) {
            Iterator<JsonNode> els = childsNode.elements();
            while (els.hasNext()) {
                JsonNode node = els.next();
                name = node.get("name") != null ? node.get("name").asText() : null;
                String value = node.get("$") != null ? node.get("$").asText() : null;
View Full Code Here

            public List<RevisionInfo> doWithResponse(HttpResponse response)
                    throws IOException {
                String responseBody = EntityUtils.toString(response.getEntity(), "UTF-8");
                JsonNode node = mapper.readTree(responseBody);
                JsonNode revsJson = node.get("_revs_info");
                Iterator<JsonNode> revsJsonIt = revsJson.elements();
                List<RevisionInfo> result = new ArrayList<>();
                while (revsJsonIt.hasNext()) {
                    RevisionInfo revisionInfo = mapper.readValue(revsJsonIt.next().toString(), RevisionInfo.class);
                    result.add(revisionInfo);
                }
View Full Code Here

            principal = mapOfPrincipals.next();
            schema = principal.getKey();
            principalNode = principal.getValue();

            if (principalNode.isArray()) {
                elements = principalNode.elements();
                while (elements.hasNext()) {
                    principals.add(createPrincipal(schema, elements.next()));
                }
            } else {
                principals.add(createPrincipal(schema, principalNode));
View Full Code Here

            values = new LinkedList<String>();
            field = mapOfFields.next();
            fieldValue = field.getValue();

            if (fieldValue.isArray()) {
                elements = fieldValue.elements();
                while (elements.hasNext()) {
                    values.add(elements.next().asText());
                }
            } else {
                values.add(fieldValue.asText());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.