Search in sources :

Example 56 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project azure-sdk-for-java by Azure.

the class DeployUsingARMTemplate method validateAndAddFieldValue.

private static void validateAndAddFieldValue(String type, String fieldValue, String fieldName, String errorMessage, JsonNode tmp) throws IllegalAccessException {
    // Add count variable for loop....
    final ObjectMapper mapper = new ObjectMapper();
    final ObjectNode parameter = mapper.createObjectNode();
    parameter.put("type", type);
    if (type == "int") {
        parameter.put("defaultValue", Integer.parseInt(fieldValue));
    } else {
        parameter.put("defaultValue", fieldValue);
    }
    ObjectNode.class.cast(tmp.get("parameters")).replace(fieldName, parameter);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 57 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project azure-sdk-for-java by Azure.

the class DeployUsingARMTemplateWithProgress method validateAndAddFieldValue.

private static void validateAndAddFieldValue(String type, String fieldValue, String fieldName, String errorMessage, JsonNode tmp) throws IllegalAccessException {
    // Add count variable for loop....
    final ObjectMapper mapper = new ObjectMapper();
    final ObjectNode parameter = mapper.createObjectNode();
    parameter.put("type", type);
    if (type == "int") {
        parameter.put("defaultValue", Integer.parseInt(fieldValue));
    } else {
        parameter.put("defaultValue", fieldValue);
    }
    ObjectNode.class.cast(tmp.get("parameters")).replace(fieldName, parameter);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 58 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jackson-databind by FasterXML.

the class StdSerializer method createSchemaNode.

/*
    /**********************************************************
    /* Helper methods for JSON Schema generation
    /**********************************************************
     */
protected ObjectNode createSchemaNode(String type) {
    ObjectNode schema = JsonNodeFactory.instance.objectNode();
    schema.put("type", type);
    return schema;
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode)

Example 59 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jackson-databind by FasterXML.

the class BeanSerializerBase method getSchema.

@Deprecated
@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException {
    ObjectNode o = createSchemaNode("object", true);
    // [JACKSON-813]: Add optional JSON Schema id attribute, if found
    // NOTE: not optimal, does NOT go through AnnotationIntrospector etc:
    JsonSerializableSchema ann = _handledType.getAnnotation(JsonSerializableSchema.class);
    if (ann != null) {
        String id = ann.id();
        if (id != null && id.length() > 0) {
            o.put("id", id);
        }
    }
    //todo: should the classname go in the title?
    //o.put("title", _className);
    ObjectNode propertiesNode = o.objectNode();
    final PropertyFilter filter;
    if (_propertyFilterId != null) {
        filter = findPropertyFilter(provider, _propertyFilterId, null);
    } else {
        filter = null;
    }
    for (int i = 0; i < _props.length; i++) {
        BeanPropertyWriter prop = _props[i];
        if (filter == null) {
            prop.depositSchemaProperty(propertiesNode, provider);
        } else {
            filter.depositSchemaProperty(prop, propertiesNode, provider);
        }
    }
    o.set("properties", propertiesNode);
    return o;
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JsonSerializableSchema(com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema)

Example 60 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jackson-databind by FasterXML.

the class ByteArraySerializer method getSchema.

@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint) {
    ObjectNode o = createSchemaNode("array", true);
    //binary values written as strings?
    ObjectNode itemSchema = createSchemaNode("byte");
    return o.set("items", itemSchema);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)769 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)185 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)167 JsonNode (com.fasterxml.jackson.databind.JsonNode)165 Test (org.junit.Test)112 StringEntity (org.apache.http.entity.StringEntity)88 Deployment (org.activiti.engine.test.Deployment)84 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)67 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)64 Task (org.activiti.engine.task.Task)49 HttpPost (org.apache.http.client.methods.HttpPost)49 JCodeModel (com.sun.codemodel.JCodeModel)45 JPackage (com.sun.codemodel.JPackage)44 IOException (java.io.IOException)44 HttpPut (org.apache.http.client.methods.HttpPut)40 JType (com.sun.codemodel.JType)39 HashMap (java.util.HashMap)39 Cluster (org.apache.geode.tools.pulse.internal.data.Cluster)39 Map (java.util.Map)33 ArrayList (java.util.ArrayList)32