Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper.valueToTree()


        ConfigurationDefinition definition = loadDescriptor("listOfPlainMaps");

        ObjectMapper mapper = new ObjectMapper();
        ComplexResult result = mapper.readValue(resultString, ComplexResult.class);
        JsonNode json = mapper.valueToTree(result);

        FakeConnection connection = new FakeConnection();
        connection.setContent(json);

        ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(definition, connection, null);
View Full Code Here


        ConfigurationDefinition definition = loadDescriptor("groupedproperties");

        ObjectMapper mapper = new ObjectMapper();
        ComplexResult result = mapper.readValue(resultString, ComplexResult.class);
        JsonNode json = mapper.valueToTree(result);

        FakeConnection connection = new FakeConnection();
        connection.setContent(json);

        ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(definition, connection, null);
View Full Code Here

        ConfigurationDefinition definition = loadServiceDescriptorElement("simpleGroupNoSpecial");

        //Formally construct the json response
        ObjectMapper mapper = new ObjectMapper();
        ComplexResult result = mapper.readValue(resultString, ComplexResult.class);
        JsonNode json = mapper.valueToTree(result);

        //Create fake connection and prepopulate the response.
        FakeConnection connection = new FakeConnection();
        connection.setContent(json);
View Full Code Here

    private static JsonNode toJson(final DateRangePickerOptions pickerOptions) {
        final ObjectMapper mapper = new ObjectMapper();
        mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
        mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
        return mapper.valueToTree(pickerOptions);
    }

}
View Full Code Here

        config.setTimeToLive(3360);
        unifiedPushMessage.setConfig(config);

        //then
        final ObjectMapper mapper = new ObjectMapper();
        final JsonNode value = mapper.valueToTree(unifiedPushMessage);

        JsonNode format = mapper.reader().readTree(getClass().getResourceAsStream("/message-format.json"));
        assertEquals(format, value);
    }
View Full Code Here

public abstract class Entity {
   
  public ObjectNode toJson(boolean includeIdAndRev) {
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode root = mapper.valueToTree(this);   
    if (includeIdAndRev) {
      root.put("id", getId());
      root.put("revision", getRevision());
    }
    return root;
View Full Code Here

    }
  }
 
  protected ObjectNode toInternalJson() {
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode root = mapper.valueToTree(this);   
    root.remove("id");
    root.remove("revision");
    return root;
  }
 
View Full Code Here

    return root;
  }
 
  public ObjectNode toJsonNode() {
    ObjectMapper mapper = new ObjectMapper();
    return mapper.valueToTree(this);
  }
     
  public static <T> T fromJson(byte[] in, Class<T> clazz) {
     MappingJsonFactory jsonFactory = new MappingJsonFactory(); // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
     try {
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.