Examples of numberValue()


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

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

                    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

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

    @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

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

    @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

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

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

Examples of com.google.template.soy.data.SoyData.numberValue()

    SoyData operand0 = visit(node.getChild(0));
    SoyData operand1 = visit(node.getChild(1));
    if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) {
      return convertResult(operand0.integerValue() * operand1.integerValue());
    } else {
      return convertResult(operand0.numberValue() * operand1.numberValue());
    }
  }


  @Override protected SoyData visitDivideByOpNode(DivideByOpNode node) {
View Full Code Here

Examples of com.google.template.soy.data.SoyData.numberValue()

  @Override protected SoyData visitDivideByOpNode(DivideByOpNode node) {

    SoyData operand0 = visit(node.getChild(0));
    SoyData operand1 = visit(node.getChild(1));
    // Note: Soy always performs floating-point division, even on two integers (like JavaScript).
    return convertResult(operand0.numberValue() / operand1.numberValue());
  }


  @Override protected SoyData visitModOpNode(ModOpNode node) {
View Full Code Here

Examples of com.google.template.soy.data.SoyData.numberValue()

    } else if (operand0 instanceof StringData || operand1 instanceof StringData) {
      // String concatenation. Note we're calling toString() instead of stringValue() in case one
      // of the operands needs to be coerced to a string.
      return convertResult(operand0.toString() + operand1.toString());
    } else {
      return convertResult(operand0.numberValue() + operand1.numberValue());
    }
  }


  @Override protected SoyData visitMinusOpNode(MinusOpNode node) {
View Full Code Here

Examples of com.google.template.soy.data.SoyData.numberValue()

    SoyData operand0 = visit(node.getChild(0));
    SoyData operand1 = visit(node.getChild(1));
    if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) {
      return convertResult(operand0.integerValue() - operand1.integerValue());
    } else {
      return convertResult(operand0.numberValue() - operand1.numberValue());
    }
  }


  @Override protected SoyData visitLessThanOpNode(LessThanOpNode node) {
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.