Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonNode


  public static class TaskNameDeserializer extends JsonDeserializer<TaskName> {
    @Override
    public TaskName deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      return new TaskName(node.getTextValue());
    }
View Full Code Here


  public static class SystemStreamPartitionDeserializer extends JsonDeserializer<SystemStreamPartition> {
    @Override
    public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      String system = node.get("system").getTextValue();
      String stream = node.get("stream").getTextValue();
      Partition partition = new Partition(node.get("partition").getIntValue());
      return new SystemStreamPartition(system, stream, partition);
    }
View Full Code Here

    String content = URLDecoder.decode(req.getParameter("content"),
      "UTF-8");

    ObjectMapper om = new ObjectMapper();

    JsonNode requestJson = om.readValue(content, JsonNode.class);

    RemoteDependencyDeclaration remoteDependency = RemoteDependencyDeclaration
      .fromJson(requestJson);
    String identifier = remoteDependency.getIdentifier();
View Full Code Here

 
        System.out.println("Decoded value=" + decoded);
 
        ObjectMapper om = new ObjectMapper();
 
        JsonNode node = om.readValue(decoded, JsonNode.class);
 
        Map<String, String> endpoints = om.convertValue(
          node.get("endpoint_entry"),
          new TypeReference<Map<String, String>>() {
          });
 
        for (Map.Entry<String, String> entry : endpoints.entrySet()) {
      String interfacename = entry.getKey();
View Full Code Here

    }
    HashMap<String, Object> map = new HashMap<String, Object>();
    for (Iterator<Entry<String, JsonNode>> iter = rootNode.getFields(); iter
        .hasNext();) {
      Entry<String, JsonNode> field = iter.next();
      JsonNode value = field.getValue();
      Object o = jsonNodeAsSimpleObject(value);
      map.put(field.getKey(), o);
    }

    return map;
View Full Code Here

     * @return RemoteDependency corresponding to <code>json</code>
     * @throws IllegalArgumentException
     */
    public static RemoteDependencyDeclaration fromJson(JsonNode json)
      throws IllegalArgumentException {
  JsonNode rr_json = json.get(JSON_RESOLVABLE_REF);

  // Get the RemoteDependency id
  String id = json.get(JSON_ID).asText();

  // Get the RemoteDependency is multiple boolean
  Boolean multiple = json.get(JSON_IS_MULTIPLE).getBooleanValue();

  // Create the ComponentReference from its name
  ComponentReference<?> compref = new ComponentReference(json.get(
    JSON_COMP_REF_NAME).asText());

  // Get the ResolvableReference type
  RRTYPE rr_type = RRTYPE.valueOf(rr_json.get(JSON_RESOLVABLE_REF_TYPE)
    .asText());

  // Get the ResolvableReference name
  String rr_name = rr_json.get(JSON_RESOLVABLE_REF_NAME).asText();

  String providerURL = json.get(JSON_PROVIDER_URL).asText();

  ResolvableReference rr = null;
  // Create the ResolvableReference according to its type.
View Full Code Here

        if (isEmpty(geoLocation)) {
            throw new IllegalStateException("Got the unexpected value '" + geoLocation + "' for the geolocation");
        }

        ObjectMapper mapper = new ObjectMapper();
        JsonNode node = mapper.readValue(geoLocation, JsonNode.class);
        JsonNode latitudeNode = notNull(node.get("latitude"), "latitude");
        JsonNode longitudeNode = notNull(node.get("longitude"), "longitude");

        return "lat=" + latitudeNode + "&lon=" + longitudeNode;
    }
View Full Code Here

        this.ticketId = UUID.fromString(obj.get("ticketId").asText());
        this.eventId = obj.get("eventId").asText();

        this.userIds = new ArrayList<String>();
        if (userIds != null) {
            JsonNode array = obj.get("userIds");
            for (int i = 0; i < array.size(); ++i)
                userIds.add(array.get(i).asText());
        }

        this.notificationType = NotificationType.safeValueOf(obj.get("notificationType").asText());
        this.createdAt = new DateTime(obj.get("createdAt").asLong());
    }
View Full Code Here

        this.comment = obj.get("comment").asText();
        this.status = ParticipationStatus.safeValueOf(obj.get("status").asText());
        this.modificationStatus = ModificationStatus.safeValueOf(obj.get("modificationStatus").asText());
        this.attendanceStatus = AttendanceStatus.safeValueOf(obj.get("attendanceStatus").asText());
        if (obj.has("enqueteAnswers")) {
            JsonNode map = obj.get("enqueteAnswers");
            this.enqueteAnswers = Util.parseEnqueteAnswers(map);
        }
        this.appliedAt = new DateTime(obj.get("appliedAt").asLong());
        this.createdAt = new DateTime(obj.get("createdAt").asLong());
        if (obj.has("modifiedAt"))
View Full Code Here

    public void assertXMLEqual(String expectedXml,
                                String resultXml) {
        try {
            ObjectMapper mapper = new ObjectMapper();
            JsonNode expectedTree = mapper.readTree( expectedXml );
            JsonNode resultTree = mapper.readTree( resultXml );
            assertEquals("Expected:" + expectedXml + "\nwas:" + resultXml,
                    expectedTree, resultTree);
        } catch ( Exception e ) {
            throw new RuntimeException( "XML Assertion failure",
                                        e );
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.JsonNode

Copyright © 2018 www.massapicom. 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.