Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectReader.readTree()


      HttpGet httpGet = new HttpGet(SERVICE_URL);
      HttpResponse res = http.execute(httpGet);
      HttpEntity entity = res.getEntity();

      if (entity != null && Utils.isJsonType(entity.getContentType().getValue())) {
        JsonNode jsonNode = reader.readTree(entity.getContent());
        if (jsonNode != null) {
          JsonNode rates = jsonNode.get("rates");
          if (rates != null) {
            map = reader.treeToValue(rates, Map.class);
            s.setId(FXRATES_KEY);
View Full Code Here


      HttpGet httpGet = new HttpGet(SERVICE_URL);
      HttpResponse res = http.execute(httpGet);
      HttpEntity entity = res.getEntity();

      if (entity != null && isJSON(entity.getContentType().getValue())) {
        JsonNode jsonNode = reader.readTree(entity.getContent());
        if (jsonNode != null) {
          JsonNode rates = jsonNode.get("rates");
          if (rates != null) {
            map = reader.treeToValue(rates, Map.class);
            s.setId(Config.FXRATES_KEY);
View Full Code Here

        //when
        final StringBuilder patched = requestTransformer.transform("/rest/sender", "100", current);

        //then
        final JsonNode patchedNode = reader.readTree(patched.toString());
        JsonNode newNode = reader.readTree(getClass().getResourceAsStream("/new-message-format.json"));

        assertEquals(newNode, patchedNode);
    }
}
View Full Code Here

        //when
        final StringBuilder patched = requestTransformer.transform("/rest/sender", "100", current);

        //then
        final JsonNode patchedNode = reader.readTree(patched.toString());
        JsonNode newNode = reader.readTree(getClass().getResourceAsStream("/new-message-format.json"));

        assertEquals(newNode, patchedNode);
    }
}
View Full Code Here

      final DeserializationContext ctxt) throws JsonProcessingException,
      IOException {
    final ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
    final ObjectReader reader = mapper.reader().without(
        DeserializationFeature.UNWRAP_ROOT_VALUE);
    final ObjectNode recordNode = reader.readTree(jsonParser);

    final JsonNode recordTypeNode = recordNode.get(TYPE_FIELD_NAME);
    if (recordTypeNode == null) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.missingField,
View Full Code Here

      final DeserializationContext ctxt) throws JsonProcessingException,
      IOException {
    final ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
    final ObjectReader reader = mapper.reader().without(
        DeserializationFeature.UNWRAP_ROOT_VALUE);
    final ObjectNode recordNode = reader.readTree(jsonParser);

    final JsonNode recordTypeNode = recordNode.get(TYPE_FIELD_NAME);
    if (recordTypeNode == null) {
      throw new MissingFieldJsonDeserializationException(
          TYPE_FIELD_NAME, "resource record");
View Full Code Here

      final DeserializationContext ctxt) throws JsonProcessingException,
      IOException {
    final ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
    final ObjectReader reader = mapper.reader().without(
        DeserializationFeature.UNWRAP_ROOT_VALUE);
    final ObjectNode recordNode = reader.readTree(jsonParser);

    final JsonNode recordTypeNode = recordNode.get(TYPE_FIELD_NAME);
    if (recordTypeNode == null) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.missingField,
View Full Code Here

                Object dto = null;
                try {
                    ObjectReader reader = objectMapper.reader();
                    JsonNode tree = null;
                    if (json != null) {
                        tree = reader.readTree(new ByteArrayInputStream(json));
                        if (tree != null) {
                            JsonNode kindNode = tree.get("kind");
                            if (kindNode != null) {
                                String kind = kindNode.asText();
                                if (Objects.equal("Pod", kind)) {
View Full Code Here

     * {@link JsonNode} if it cannot be recognised.
     */
    public static Object loadJson(byte[] json) throws IOException {
        if (json != null && json.length > 0) {
            ObjectReader reader = objectMapper.reader();
            JsonNode tree = reader.readTree(new ByteArrayInputStream(json));
            if (tree != null) {
                JsonNode kindNode = tree.get("kind");
                if (kindNode != null) {
                    String kind = kindNode.asText();
                    if (Objects.equal("Pod", kind)) {
View Full Code Here

      HttpGet httpGet = new HttpGet(SERVICE_URL);
      HttpResponse res = http.execute(httpGet);
      HttpEntity entity = res.getEntity();

      if (entity != null && isJSON(entity.getContentType().getValue())) {
        JsonNode jsonNode = reader.readTree(entity.getContent());
        if (jsonNode != null) {
          JsonNode rates = jsonNode.get("rates");
          if (rates != null) {
            map = reader.treeToValue(rates, Map.class);
            s.setId(Config.FXRATES_KEY);
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.