当前位置: 首页>>代码示例>>Java>>正文


Java JsonSchema.isObjectSchema方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.module.jsonSchema.JsonSchema.isObjectSchema方法的典型用法代码示例。如果您正苦于以下问题:Java JsonSchema.isObjectSchema方法的具体用法?Java JsonSchema.isObjectSchema怎么用?Java JsonSchema.isObjectSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.module.jsonSchema.JsonSchema的用法示例。


在下文中一共展示了JsonSchema.isObjectSchema方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchPaths

import com.fasterxml.jackson.module.jsonSchema.JsonSchema; //导入方法依赖的package包/类
static void fetchPaths(final String context, final List<String> paths, final Map<String, JsonSchema> properties) {
    for (final Entry<String, JsonSchema> entry : properties.entrySet()) {
        final JsonSchema subschema = entry.getValue();

        String path;
        final String key = entry.getKey();
        if (context == null) {
            path = key;
        } else {
            path = context + "." + key;
        }

        if (subschema.isValueTypeSchema()) {
            paths.add(path);
        } else if (subschema.isObjectSchema()) {
            fetchPaths(path, paths, ((ObjectSchema) subschema).getProperties());
        }
    }
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:20,代码来源:JsonSchemaInspector.java

示例2: findRefs

import com.fasterxml.jackson.module.jsonSchema.JsonSchema; //导入方法依赖的package包/类
private void findRefs(JsonSchema schema, Map<String, JsonSchema> refs, Set<String> referenced) {
  addRef(schema, refs);
  if (schema instanceof ReferenceSchema) {
    referenced.add(schema.get$ref());
  } else if (schema.isArraySchema()) {
    ArraySchema as = schema.asArraySchema();
    if (as.getItems() != null) {
      if (as.getItems().isSingleItems()) {
        findRefs(as.getItems().asSingleItems().getSchema(), refs, referenced);
      } else if (as.getItems().isArrayItems()) {
        ArrayItems items = as.getItems().asArrayItems();
        for (JsonSchema item : items.getJsonSchemas()) {
          findRefs(item, refs, referenced);
        }
      } else {
        throw new UnsupportedOperationException(as.getItems().toString());
      }
    }
  } else if (schema.isObjectSchema()) {
    ObjectSchema os = schema.asObjectSchema();
    for (JsonSchema value : os.getProperties().values()) {
      findRefs(value, refs, referenced);
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:26,代码来源:Doc.java

示例3: iterateOnProperties

import com.fasterxml.jackson.module.jsonSchema.JsonSchema; //导入方法依赖的package包/类
public void iterateOnProperties(Map<String, JsonSchema> properties) {
	properties.remove("type");
	for (Entry<String, JsonSchema> entry : properties.entrySet()) {
		entry.getValue().setId(null);
		if (entry.getValue().isSimpleTypeSchema()) {
			entry.getValue().asSimpleTypeSchema().setTitle(entry.getKey());
			if (entry.getValue().isObjectSchema()) {
				iterateOnProperties(entry.getValue().asObjectSchema().getProperties());
			}
			if (entry.getValue().isArraySchema()) {
				JsonSchema arraySchema = entry.getValue().asArraySchema().getItems().asSingleItems().getSchema();
				arraySchema.setId(null);
				if (arraySchema.isSimpleTypeSchema()) {
					arraySchema.asSimpleTypeSchema().setTitle(entry.getKey().substring(0, entry.getKey().length() - 1));
					if (arraySchema.isObjectSchema()) {
						iterateOnProperties(arraySchema.asObjectSchema().getProperties());
					}
				}
			}
		}
	}
}
 
开发者ID:Treydone,项目名称:mandrel,代码行数:23,代码来源:SchemaGenerator.java

示例4: example

import com.fasterxml.jackson.module.jsonSchema.JsonSchema; //导入方法依赖的package包/类
/**
 * generates a json example
 * @param sb the output
 * @param indent the current indent prefix
 * @param schema the schema to print an example for
 * @param refs for referenced schema (when used more than once)
 * @param followed to avoid infinite loops in recursive schema
 * @param referenced the types that are referenced and should have an annotation
 */
private void example(StringBuilder sb, int maxlength, String indent, JsonSchema schema, Map<String, JsonSchema> refs, Set<String> followed, Set<String> referenced) {
  if (sb.length() > maxlength) {
    sb.append("example is too big, truncated...");
    return;
  }
  followed = new HashSet<>(followed);
  String id = schema.getId();
  if (id == null && schema instanceof ReferenceSchema) {
    id = schema.get$ref();
  }
  if (id != null && followed.contains(id)) {
    sb.append(refExample(id));
    return;
  }
  if (schema.isObjectSchema()) {
    followed.add(id);
    objectExample(sb, maxlength, indent, schema, refs, followed, referenced, id);
  } else if (schema.isArraySchema()) {
    arrayExample(sb, maxlength, indent, schema, refs, followed, referenced);
  } else if (schema instanceof ReferenceSchema) {
    if (refs.containsKey(schema.get$ref())) {
      example(sb, maxlength, indent, refs.get(schema.get$ref()), refs, followed, referenced);
    } else {
      sb.append(refExample(schema.get$ref()));
    }
  } else {
    sb.append(primitiveTypeExample(schema));
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:39,代码来源:Doc.java


注:本文中的com.fasterxml.jackson.module.jsonSchema.JsonSchema.isObjectSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。