本文整理汇总了Java中com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema类的典型用法代码示例。如果您正苦于以下问题:Java JsonSerializableSchema类的具体用法?Java JsonSerializableSchema怎么用?Java JsonSerializableSchema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonSerializableSchema类属于com.fasterxml.jackson.databind.jsonschema包,在下文中一共展示了JsonSerializableSchema类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSchema
import com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema; //导入依赖的package包/类
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;
}
示例2: getSchema
import com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema; //导入依赖的package包/类
@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;
}