Example usage for com.fasterxml.jackson.databind.node JsonNodeFactory numberNode

List of usage examples for com.fasterxml.jackson.databind.node JsonNodeFactory numberNode

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.node JsonNodeFactory numberNode.

Prototype

public NumericNode numberNode(BigInteger paramBigInteger) 

Source Link

Usage

From source file:com.redhat.lightblue.metadata.rdbms.converter.Range.java

@Override
public String toString() {
    JsonNodeFactory jsonNodeFactory = JsonNodeFactory.withExactBigDecimals(true);

    ObjectNode objectNode = jsonNodeFactory.objectNode();

    JsonNode jsonNode = from == null ? jsonNodeFactory.nullNode() : jsonNodeFactory.numberNode(from);
    objectNode.set("from", jsonNode);

    jsonNode = to == null ? jsonNodeFactory.nullNode() : jsonNodeFactory.numberNode(to);
    objectNode.set("to", jsonNode);

    return JsonUtils.prettyPrint(objectNode);
}

From source file:com.redhat.lightblue.metadata.rdbms.converter.RDBMSContext.java

@Override
public String toString() {
    JsonNodeFactory jsonNodeFactory1 = jsonNodeFactory;
    if (jsonNodeFactory == null) {
        jsonNodeFactory1 = JsonNodeFactory.withExactBigDecimals(true);
    }/*from  www .j  a  v a  2s.  c  o  m*/
    ObjectNode objectNode = jsonNodeFactory1.objectNode();
    NullNode nullNode = jsonNodeFactory1.nullNode();
    String nullNodeString = JsonUtils.prettyPrint(nullNode);
    String s = null;
    JsonNode j = null;
    try {

        s = fromToQueryRange == null ? nullNodeString : fromToQueryRange.toString();
        objectNode.set("fromToQueryRange", JsonUtils.json(s));

        j = dataSource == null ? nullNode : jsonNodeFactory1.textNode(dataSource.toString());
        objectNode.set("dataSource", j);

        j = dataSourceName == null ? nullNode : jsonNodeFactory1.textNode(dataSourceName.toString());
        objectNode.set("dataSourceName", j);

        j = connection == null ? nullNode : jsonNodeFactory1.textNode(connection.toString());
        objectNode.set("connection", j);

        j = preparedStatement == null ? nullNode : jsonNodeFactory1.textNode(preparedStatement.toString());
        objectNode.set("preparedStatement", j);

        j = resultBoolean == null ? nullNode : jsonNodeFactory1.booleanNode(resultBoolean);
        objectNode.set("resultBoolean", j);

        j = resultInteger == null ? nullNode : jsonNodeFactory1.numberNode(resultInteger);
        objectNode.set("resultInteger", j);

        j = rowMapper == null ? nullNode : jsonNodeFactory1.textNode(rowMapper.toString());
        objectNode.set("rowMapper", j);

        if (resultList != null) {
            ArrayNode jsonNodes = jsonNodeFactory1.arrayNode();
            for (T a : resultList) {
                jsonNodes.add(a.toString());
            }
            objectNode.set("resultList", jsonNodes);
        } else {
            objectNode.set("resultList", nullNode);
        }

        s = rdbms == null ? nullNodeString : rdbms.toString();
        objectNode.set("rdbms", JsonUtils.json(s));

        j = sql == null ? nullNode : jsonNodeFactory1.textNode(sql.toString());
        objectNode.set("sql", j);

        j = type == null ? nullNode : jsonNodeFactory1.textNode(type.toString());
        objectNode.set("type", j);

        j = entityMetadata == null ? nullNode : jsonNodeFactory1.textNode(entityMetadata.toString());
        objectNode.set("entityMetadata", j);

        j = queryExpression == null ? nullNode : jsonNodeFactory1.textNode(queryExpression.toString());
        objectNode.set("queryExpression", j);

        j = projection == null ? nullNode : jsonNodeFactory1.textNode(projection.toString());
        objectNode.set("projection", j);

        j = sort == null ? nullNode : jsonNodeFactory1.textNode(sort.toString());
        objectNode.set("sort", j);

        if (temporaryVariable != null) {
            ObjectNode jsonNodes = jsonNodeFactory1.objectNode();
            for (Map.Entry<String, Object> a : temporaryVariable.entrySet()) {
                jsonNodes.set(a.getKey(), jsonNodeFactory1.textNode(a.getValue().toString()));
            }
            objectNode.set("temporaryVariable", jsonNodes);
        } else {
            objectNode.set("temporaryVariable", nullNode);
        }

        if (in != null) {
            ArrayNode jsonNodes = jsonNodeFactory1.arrayNode();
            for (InOut a : in) {
                jsonNodes.add(a.toString());
            }
            objectNode.set("in", jsonNodes);
        } else {
            objectNode.set("in", nullNode);
        }

        s = out == null ? nullNodeString : out.toString();
        if (out != null) {
            ArrayNode jsonNodes = jsonNodeFactory1.arrayNode();
            for (InOut a : out) {
                jsonNodes.add(a.toString());
            }
            objectNode.set("out", jsonNodes);
        } else {
            objectNode.set("out", nullNode);
        }

        s = inVar == null ? nullNodeString : inVar.toString();
        objectNode.set("inVar", JsonUtils.json(s));

        s = outVar == null ? nullNodeString : outVar.toString();
        objectNode.set("outVar", JsonUtils.json(s));

        objectNode.set("initialInput", JsonUtils.json(Boolean.toString(initialInput)));

        if (inputMappedByField != null) {
            ObjectNode jsonNodes = jsonNodeFactory1.objectNode();
            for (Map.Entry<String, Object> a : inputMappedByField.entrySet()) {
                jsonNodes.set(a.getKey(), jsonNodeFactory1.textNode(a.getValue().toString()));
            }
            objectNode.set("inputMappedByField", jsonNodes);
        } else {
            objectNode.set("inputMappedByField", nullNode);
        }

        if (inputMappedByColumn != null) {
            ObjectNode jsonNodes = jsonNodeFactory1.objectNode();
            for (Map.Entry<String, Object> a : inputMappedByColumn.entrySet()) {
                jsonNodes.set(a.getKey(), jsonNodeFactory1.textNode(a.getValue().toString()));
            }
            objectNode.set("inputMappedByColumn", jsonNodes);
        } else {
            objectNode.set("inputMappedByColumn", nullNode);
        }

        s = jsonNodeFactory == null ? nullNodeString : jsonNodeFactory.toString();
        objectNode.set("jsonNodeFactory", jsonNodeFactory1.textNode(s));

        s = RDBMSDataSourceResolver == null ? nullNodeString : RDBMSDataSourceResolver.toString();
        objectNode.set("RDBMSDataSourceResolver", JsonUtils.json(s));

        s = fieldAccessRoleEvaluator == null ? nullNodeString : fieldAccessRoleEvaluator.toString();
        objectNode.set("fieldAccessRoleEvaluator", jsonNodeFactory1.textNode(s));

        s = CRUDOperationName == null ? nullNodeString : CRUDOperationName.toString();
        objectNode.set("CRUDOperationName", jsonNodeFactory1.textNode(s));

        s = crudOperationContext == null ? nullNodeString : crudOperationContext.toString();
        objectNode.set("crudOperationContext", jsonNodeFactory1.textNode(s));

        s = currentLoopOperator == null ? nullNodeString : currentLoopOperator.toString();
        objectNode.set("currentLoopOperator", jsonNodeFactory1.textNode(s));

        s = updateExpression == null ? nullNodeString : updateExpression.toString();
        objectNode.set("updateExpression", jsonNodeFactory1.textNode(s));

    } catch (IOException e) {
        throw new IllegalStateException(e);
    }

    return JsonUtils.prettyPrint(objectNode);
}