Examples of asText()


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

            JsonNode jobIdNode = serviceNode.path(JsonConstants.Job.ID);
            if(jobIdNode.isMissingNode()) throw new IllegalStateException("service-id is missing");

            Service.Builder serviceBuilder;
            if(typeNode.isMissingNode()) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.SERVICE)) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.PICKUP)) serviceBuilder = Pickup.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.DELIVERY)) serviceBuilder = Delivery.Builder.newInstance(jobIdNode.asText());
            else throw new IllegalStateException("type of service ("+typeNode.asText()+") is not supported");

            //service address
View Full Code Here

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

            if(jobIdNode.isMissingNode()) throw new IllegalStateException("service-id is missing");

            Service.Builder serviceBuilder;
            if(typeNode.isMissingNode()) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.SERVICE)) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.PICKUP)) serviceBuilder = Pickup.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.DELIVERY)) serviceBuilder = Delivery.Builder.newInstance(jobIdNode.asText());
            else throw new IllegalStateException("type of service ("+typeNode.asText()+") is not supported");

            //service address
            JsonNode addressIdNode = serviceNode.path(JsonConstants.Job.ADDRESS).path(JsonConstants.Address.ID);
View Full Code Here

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

            Service.Builder serviceBuilder;
            if(typeNode.isMissingNode()) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.SERVICE)) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.PICKUP)) serviceBuilder = Pickup.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.DELIVERY)) serviceBuilder = Delivery.Builder.newInstance(jobIdNode.asText());
            else throw new IllegalStateException("type of service ("+typeNode.asText()+") is not supported");

            //service address
            JsonNode addressIdNode = serviceNode.path(JsonConstants.Job.ADDRESS).path(JsonConstants.Address.ID);
            boolean either_locationId_or_coord = false;
View Full Code Here

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

            //service address
            JsonNode addressIdNode = serviceNode.path(JsonConstants.Job.ADDRESS).path(JsonConstants.Address.ID);
            boolean either_locationId_or_coord = false;
            if(!addressIdNode.isMissingNode()){
                serviceBuilder.setLocationId(addressIdNode.asText());
                either_locationId_or_coord = true;
            }
            {
                JsonNode lonNode = serviceNode.path(JsonConstants.Job.ADDRESS).path(JsonConstants.Address.LON);
                JsonNode latNode = serviceNode.path(JsonConstants.Job.ADDRESS).path(JsonConstants.Address.LAT);
View Full Code Here

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

   * @return
   */
  private Object readSingle(JsonNode node, ClassLoader classLoader) throws IOException {

    JsonNode typeNode = node.findValue(typeKey);
    String typeName = typeNode == null ? null : typeNode.asText();

    Class<?> type = ClassUtils.resolveClassName(typeName, classLoader);

    return mapper.reader(type).readValue(node);
  }
View Full Code Here

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

        while (iter.hasNext()) {
            final Map.Entry<String, JsonNode> entry = iter.next();
            if (entry.getKey().equalsIgnoreCase("type")) {
                final JsonNode n = entry.getValue();
                if (n.isValueNode()) {
                    return n.asText();
                }
            }
        }
        return name;
    }
View Full Code Here

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

        while (iter.hasNext()) {
            final Map.Entry<String, JsonNode> entry = iter.next();
            if (!entry.getKey().equalsIgnoreCase("type")) {
                final JsonNode n = entry.getValue();
                if (n.isValueNode()) {
                    attrs.put(entry.getKey(), n.asText());
                }
            }
        }
    }
View Full Code Here

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

        Comment question = Comment.find.byId(idComment);

        JsonNode node = request().body().asJson();
        String commentForm = null;
        boolean privateComment = false;
        Logger.debug("nose : {}", node.asText());
        if (node != null && node.get("comment") != null && !node.get("comment").equals("null")) {
            commentForm = node.get("comment").asText();
            if (user.admin && node.get("private") != null) {
                privateComment = node.get("private").asBoolean();
            }
View Full Code Here

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

        Proposal proposal = Proposal.find.byId(idProposal);
        Comment question = Comment.find.byId(idComment);

        JsonNode node = request().body().asJson();
        String commentForm = null;
        Logger.debug("nose : {}", node.asText());
        if (node != null && node.get("comment") != null && !node.get("comment").equals("null")) {
            commentForm = node.get("comment").asText();
        } else {
            Map<String, List<String>> errors = new HashMap<String, List<String>>();
            errors.put("commentE", Collections.singletonList(Messages.get("error.required")));
View Full Code Here

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

                } else if (value.isDouble()) {
                    tree.setProperty(name, value.asDouble());
                } else if (value.isBigDecimal()) {
                    tree.setProperty(name, value.decimalValue());
                } else {
                    tree.setProperty(name, value.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.