當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonSerializableSchema類代碼示例

本文整理匯總了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;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:28,代碼來源:BeanSerializerBase.java

示例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;
}
 
開發者ID:joyplus,項目名稱:joyplus-tv,代碼行數:38,代碼來源:BeanSerializerBase.java


注:本文中的com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。