本文整理匯總了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;
}