Java 类com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema 实例源码
项目:QuizUpWinner
文件:BeanSerializerBase.java
public JsonNode getSchema(SerializerProvider paramSerializerProvider, Type paramType)
{
ObjectNode localObjectNode1 = createSchemaNode("object", true);
JsonSerializableSchema localJsonSerializableSchema = (JsonSerializableSchema)this._handledType.getAnnotation(JsonSerializableSchema.class);
if (localJsonSerializableSchema != null)
{
String str = localJsonSerializableSchema.id();
if ((str != null) && (str.length() > 0))
localObjectNode1.put("id", str);
}
ObjectNode localObjectNode2 = localObjectNode1.objectNode();
BeanPropertyFilter localBeanPropertyFilter;
if (this._propertyFilterId != null)
localBeanPropertyFilter = findFilter(paramSerializerProvider);
else
localBeanPropertyFilter = null;
for (int i = 0; i < this._props.length; i++)
{
BeanPropertyWriter localBeanPropertyWriter = this._props[i];
if (localBeanPropertyFilter == null)
localBeanPropertyWriter.depositSchemaProperty(localObjectNode2, paramSerializerProvider);
else
localBeanPropertyFilter.depositSchemaProperty(localBeanPropertyWriter, localObjectNode2, paramSerializerProvider);
}
localObjectNode1.put("properties", localObjectNode2);
return localObjectNode1;
}
项目:joyplus-tv
文件:BeanSerializerBase.java
@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 BeanPropertyFilter filter;
if (_propertyFilterId != null) {
filter = findFilter(provider);
} 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.put("properties", propertiesNode);
return o;
}