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);
}
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);
}
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;
}
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;
}
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);
}
Aggregations