Package com.fasterxml.jackson.databind

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


            } else if (node.isDouble()) {
                values.add(node.asDouble());
            } else if (node.isLong()) {
                values.add(node.asLong());
            } else if (node.isInt()) {
                values.add(node.asInt());
            } else {
                String text = node.asText();
                if (text.startsWith(AttributeSerializer.BYTE_ARRAY_PREFIX)
                        && text.endsWith(AttributeSerializer.BYTE_ARRAY_SUFFIX)) {
View Full Code Here


            String host = root.path("hostText").asText();
            JsonNode n = root.get("port");
            if (n == null) {
                return HostAndPort.fromString(host);
            }
            return HostAndPort.fromParts(host, n.asInt());
        }
        if (t == JsonToken.VALUE_STRING) {
            return HostAndPort.fromString(jp.getText().trim());
        }
        // could also support arrays?
View Full Code Here

        @Override
        public IntOrString deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {
            ObjectCodec oc = jsonParser.getCodec();
            JsonNode node = oc.readTree(jsonParser);
            IntOrString intOrString = new IntOrString();
            int asInt = node.asInt();
            if (asInt != 0) {
                intOrString.setIntValue(asInt);
            } else {
                intOrString.setStringValue(node.asText());
            }
View Full Code Here

                    }
                    else if (value.isDouble()) {
                        call.setDouble(field, value.asDouble());
                    }
                    else if (value.isInt()) {
                        call.setInt(field, value.asInt());
                    }
                    else if (value.isLong()) {
                        call.setLong(field, value.asLong());
                    }
                    else {
View Full Code Here

    public AgeRange deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
      JsonNode ageRangeNode = jp.readValueAs(JsonNode.class);
      JsonNode minNode = (JsonNode) ageRangeNode.get("min");
      JsonNode maxNode = (JsonNode) ageRangeNode.get("max");
      Integer min = minNode != null ? minNode.asInt() : null;
      Integer max = maxNode != null ? maxNode.asInt() : null;
      return AgeRange.fromMinMax(min, max);
    }
  }
}
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.