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


Java MapProperty类代码示例

本文整理汇总了Java中io.swagger.models.properties.MapProperty的典型用法代码示例。如果您正苦于以下问题:Java MapProperty类的具体用法?Java MapProperty怎么用?Java MapProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initConverters

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private static void initConverters() {
  // inner converters
  for (Class<? extends Property> propertyCls : PROPERTY_MAP.keySet()) {
    addInnerConverter(propertyCls);
  }

  converterMap.put(RefProperty.class, new RefPropertyConverter());
  converterMap.put(ArrayProperty.class, new ArrayPropertyConverter());
  converterMap.put(MapProperty.class, new MapPropertyConverter());
  converterMap.put(StringProperty.class, new StringPropertyConverter());
  converterMap.put(ObjectProperty.class, new ObjectPropertyConverter());

  converterMap.put(ModelImpl.class, new ModelImplConverter());
  converterMap.put(RefModel.class, new RefModelConverter());
  converterMap.put(ArrayModel.class, new ArrayModelConverter());

  converterMap.put(BodyParameter.class, new BodyParameterConverter());

  AbstractSerializableParameterConverter converter = new AbstractSerializableParameterConverter();
  converterMap.put(QueryParameter.class, converter);
  converterMap.put(PathParameter.class, converter);
  converterMap.put(HeaderParameter.class, converter);
  converterMap.put(FormParameter.class, converter);
  converterMap.put(CookieParameter.class, converter);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:26,代码来源:ConverterMgr.java

示例2: createSchemaFromProperty

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private static JsonNode createSchemaFromProperty(final String specification, final Property schema) {
    if (schema instanceof MapProperty) {
        try {
            final String schemaString = Json.mapper().writeValueAsString(schema);

            return parseJsonSchema(schemaString);
        } catch (final JsonProcessingException e) {
            throw new IllegalStateException("Unable to serialize/read given JSON specification in response schema: " + schema, e);
        }
    } else if (schema instanceof StringProperty) {
        return null;
    }

    final String reference = determineSchemaReference(schema);

    final String title = Optional.ofNullable(schema.getTitle()).orElse(reference.replaceAll("^.*/", ""));

    return createSchemaFromReference(specification, title, reference);
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:20,代码来源:SwaggerUnifiedShapeConnectorGenerator.java

示例3: createShapeFromProperty

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private static DataShape createShapeFromProperty(final String specification, final Property schema) {
    if (schema instanceof MapProperty) {
        try {
            final String schemaString = Json.mapper().writeValueAsString(schema);

            return new DataShape.Builder().kind("json-schema").specification(schemaString).build();
        } catch (final JsonProcessingException e) {
            throw new IllegalStateException("Unable to serialize given JSON specification in response schema: " + schema, e);
        }
    } else if (schema instanceof StringProperty) {
        return DATA_SHAPE_NONE;
    }

    final String reference = determineSchemaReference(schema);

    final String title = Optional.ofNullable(schema.getTitle()).orElse(reference.replaceAll("^.*/", ""));

    return createShapeFromReference(specification, title, reference);
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:20,代码来源:DataShapeHelper.java

示例4: getSchemaStructureFromResponse

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private SwaggerSchema getSchemaStructureFromResponse(Response response) throws IOException {
    SwaggerSchema swaggerSchema = new SwaggerSchema();
    swaggerSchema.setDescription(response.getDescription());
    Property responseProperty = response.getSchema();

    if (responseProperty != null) {
        swaggerSchema.setType(responseProperty.getType());
        if (swaggerSchema.getType() == "object" && responseProperty instanceof MapProperty) {
            Property additionalProperties = ((MapProperty) responseProperty).getAdditionalProperties();
            swaggerSchema.setAdditionalPropertiesType(additionalProperties.getType());
        } else {
            String mainScehmaReference = getMainDefinitionNameInResponse(response);
            if (!mainScehmaReference.isEmpty())
                swaggerSchema.setParsedSchema(new SwaggerParserHelper(swagger).getDefinationsFromSchemaReference(mainScehmaReference, "root"));
        }
    }
    return swaggerSchema;
}
 
开发者ID:bsneha90,项目名称:RecursiveSwaggerSchemaParser,代码行数:19,代码来源:SwaggerSchemaResponseParser.java

示例5: createShapeFromProperty

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
static DataShape createShapeFromProperty(final String specification, final Property schema) {
    if (schema instanceof MapProperty) {
        try {
            final String schemaString = Json.mapper().writeValueAsString(schema);

            return new DataShape.Builder().kind("json-schema").specification(schemaString).build();
        } catch (final JsonProcessingException e) {
            throw new IllegalStateException(
                "Unable to serialize given JSON specification in response schema: " + schema, e);
        }
    } else if (schema instanceof StringProperty) {
        return DATA_SHAPE_NONE;
    }

    final String reference = determineSchemaReference(schema);

    final String title = Optional.ofNullable(schema.getTitle()).orElse(reference.replaceAll("^.*/", ""));

    return createShapeFromReference(specification, title, reference);
}
 
开发者ID:syndesisio,项目名称:syndesis-rest,代码行数:21,代码来源:SwaggerConnectorGenerator.java

示例6: exampleMapForProperties

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
/**
 * Generates a map of examples from a map of properties. If defined examples are found, those are used. Otherwise,
 * examples are generated from the type.
 *
 * @param properties       the map of properties
 * @param definitions      the map of definitions
 * @param markupDocBuilder the markup builder
 * @param refStack         map to detect cyclic references
 * @return a Map of examples
 */
private static Map<String, Object> exampleMapForProperties(Map<String, Property> properties, Map<String, Model> definitions, DocumentResolver definitionDocumentResolver, MarkupDocBuilder markupDocBuilder, Map<String, Integer> refStack) {
    Map<String, Object> exampleMap = new LinkedHashMap<>();
    if (properties != null) {
        for (Map.Entry<String, Property> property : properties.entrySet()) {
            Object exampleObject = property.getValue().getExample();
            if (exampleObject == null) {
                if (property.getValue() instanceof RefProperty) {
                    exampleObject = generateExampleForRefModel(true, ((RefProperty) property.getValue()).getSimpleRef(), definitions, definitionDocumentResolver, markupDocBuilder, refStack);
                } else if (property.getValue() instanceof ArrayProperty) {
                    exampleObject = generateExampleForArrayProperty((ArrayProperty) property.getValue(), definitions, definitionDocumentResolver, markupDocBuilder, refStack);
                } else if (property.getValue() instanceof MapProperty) {
                    exampleObject = generateExampleForMapProperty((MapProperty) property.getValue(), markupDocBuilder);
                }
                if (exampleObject == null) {
                    Property valueProperty = property.getValue();
                    exampleObject = PropertyAdapter.generateExample(valueProperty, markupDocBuilder);
                }
            }
            exampleMap.put(property.getKey(), exampleObject);
        }
    }
    return exampleMap;
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:34,代码来源:ExamplesUtil.java

示例7: makeProperty

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private Property makeProperty(PropertyDescription pd) {
    switch (pd.typeName) {
    case BOOLEAN:
        return new BooleanProperty();
    case BYTES:
        return new BinaryProperty();
    case COLLECTION:
        return new ArrayProperty(makeProperty(pd.elementDescription));
    case DATE:
        return new DateTimeProperty();
    case DOUBLE:
        return new DoubleProperty();
    case ENUM:
        StringProperty prop = new StringProperty();
        if (pd.enumValues != null) {
            prop._enum(Arrays.asList(pd.enumValues));
        }
        return prop;
    case InternetAddressV4:
        return new StringProperty();
    case InternetAddressV6:
        return new StringProperty();
    case LONG:
        return new LongProperty();
    case MAP:
        return new MapProperty(new StringProperty());
    case PODO:
        return refProperty(pd);
    case STRING:
        return new StringProperty();
    case URI:
        return new StringProperty(Format.URI);
    default:
        throw new IllegalStateException("unknown type " + pd.typeName);
    }
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:37,代码来源:ModelRegistry.java

示例8: withResponseContainer

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
/**
 * Response wrapper for list type
 *
 * @param type
 *            -type
 * @param property
 *            - swagger property
 * @return wrapped response
 */
private Property withResponseContainer(String type, Property property) {

    if ("list".equalsIgnoreCase(type)) {
        return new ArrayProperty(property);
    }
    if ("set".equalsIgnoreCase(type)) {
        return new ArrayProperty(property).uniqueItems();
    }
    if ("map".equalsIgnoreCase(type)) {
        return new MapProperty(property);
    }
    return property;
}
 
开发者ID:uralmax,项目名称:jsonrpc4j-swagger-maven-plugin-helper,代码行数:23,代码来源:JsonRpcSwaggerApiReader.java

示例9: generateExampleForMapProperty

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private static Object generateExampleForMapProperty(MapProperty property, MarkupDocBuilder markupDocBuilder) {
    if (property.getExample() != null) {
        return property.getExample();
    }
    Map<String, Object> exampleMap = new LinkedHashMap<>();
    Property valueProperty = property.getAdditionalProperties();
    if (valueProperty.getExample() != null) {
        return valueProperty.getExample();
    }
    exampleMap.put("string", PropertyAdapter.generateExample(valueProperty, markupDocBuilder));
    return exampleMap;
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:13,代码来源:ExamplesUtil.java

示例10: processPropertyModelRefs

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private static void processPropertyModelRefs(Property property, Map<String, Integer> modelRefCount) {
	if (property instanceof RefProperty) {
		String ref = ((RefProperty) property).getSimpleRef();
		Integer count = modelRefCount.get(ref);
		modelRefCount.put(ref, count != null ? (count + 1) : 1);
	} else if (property instanceof ArrayProperty) {
		processPropertyModelRefs(((ArrayProperty) property).getItems(), modelRefCount);
	} else if (property instanceof MapProperty) {
		processPropertyModelRefs(((MapProperty) property).getAdditionalProperties(), modelRefCount);
	}
}
 
开发者ID:isabinin,项目名称:aws-apigateway-swagger-exporter,代码行数:12,代码来源:APIGExporter.java

示例11: withResponseContainer

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
Property withResponseContainer(String responseContainer, Property property) {
    if ("list".equalsIgnoreCase(responseContainer)) {
        return new ArrayProperty(property);
    }
    if ("set".equalsIgnoreCase(responseContainer)) {
        return new ArrayProperty(property).uniqueItems();
    }
    if ("map".equalsIgnoreCase(responseContainer)) {
        return new MapProperty(property);
    }
    return property;
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:13,代码来源:ResponseContainerConverter.java

示例12: doConvert

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
@Override
public JavaType doConvert(ClassLoader classLoader, String packageName, Swagger swagger, Object property) {
  MapProperty mapProperty = (MapProperty) property;
  Property valueProperty = mapProperty.getAdditionalProperties();
  return findJavaType(classLoader, packageName, swagger, valueProperty);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:7,代码来源:MapPropertyConverter.java

示例13: testMap

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
private void testMap(Path path) {
  Operation operation = path.getPost();
  Property result200 = operation.getResponses().get("200").getSchema();
  Assert.assertEquals(MapProperty.class, result200.getClass());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:6,代码来源:TestApiOperation.java

示例14: doWrap

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
@Override
protected Property doWrap(Property property) {
	return new MapProperty(property);
}
 
开发者ID:Sayi,项目名称:swagger-dubbo,代码行数:5,代码来源:DubboReaderExtension.java

示例15: doWrap

import io.swagger.models.properties.MapProperty; //导入依赖的package包/类
protected Property doWrap(Property property) {
    return new MapProperty(property);
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:4,代码来源:ControllerReaderExtension.java


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