当前位置: 首页>>代码示例>>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;未经允许,请勿转载。