Package com.fasterxml.jackson.databind

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


  protected Number getNodeNumberValue(final ObjectNode recordNode,
      final String fieldName) {
        JsonNode fieldNode = findFieldNode(recordNode, fieldName);
        switch (fieldNode.getNodeType()) {
            case NUMBER:
                return fieldNode.numberValue();
            case STRING:
                try {
                    return NumberFormat.getInstance(Locale.getDefault()).parse(
                        fieldNode.textValue());
                } catch (final ParseException e) {
View Full Code Here


                    node = node.get(nodeName);
                }
            }
            if (node != null) {
                if (node.isNumber()) {
                    return node.numberValue();
                } else if (node.isBoolean()) {
                    return node.booleanValue();
                } else if (node.isTextual()) {
                    return node.textValue();
                } else {
View Full Code Here

    @Override
    public Float deserializeFloat(JsonReadGenericRecord record, String fieldName) {
        JsonNode node = record.getNode().isNumber() ? record.getNode() : getJsonNode(record, fieldName);
        if (node == null)
            return null;
        return node.numberValue().floatValue();
    }

    @Override
    public Double deserializeDouble(JsonReadGenericRecord record, String fieldName) {
        JsonNode node = record.getNode().isNumber() ? record.getNode() : getJsonNode(record, fieldName);
View Full Code Here

    @Override
    public Double deserializeDouble(JsonReadGenericRecord record, String fieldName) {
        JsonNode node = record.getNode().isNumber() ? record.getNode() : getJsonNode(record, fieldName);
        if (node == null)
            return null;
        return node.numberValue().doubleValue();
    }

    @Override
    public String deserializeString(JsonReadGenericRecord record, String fieldName) {
        JsonNode node = record.getNode().isTextual() ? record.getNode() : getJsonNode(record, fieldName);
View Full Code Here

  protected Number getNodeNumberValue(final ObjectNode recordNode,
      final String fieldName) {
        JsonNode fieldNode = findFieldNode(recordNode, fieldName);
        switch (fieldNode.getNodeType()) {
            case NUMBER:
                return fieldNode.numberValue();
            case STRING:
                try {
                    return NumberFormat.getInstance(Locale.getDefault()).parse(
                        fieldNode.textValue());
                } catch (final ParseException e) {
View Full Code Here

  protected Number getNodeNumberValue(final ObjectNode recordNode,
      final String fieldName) {
        JsonNode fieldNode = findFieldNode(recordNode, fieldName);
        switch (fieldNode.getNodeType()) {
            case NUMBER:
                return fieldNode.numberValue();
            case STRING:
                try {
                    return NumberFormat.getInstance(Locale.getDefault()).parse(
                        fieldNode.textValue());
                } catch (final ParseException e) {
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.