本文整理汇总了Java中io.swagger.models.ModelImpl.setProperties方法的典型用法代码示例。如果您正苦于以下问题:Java ModelImpl.setProperties方法的具体用法?Java ModelImpl.setProperties怎么用?Java ModelImpl.setProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.ModelImpl
的用法示例。
在下文中一共展示了ModelImpl.setProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defineModel
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
/**
* Define a name {@link PropertySet} Model in given {@link Swagger} instance.
* @param swagger Swagger instance (not null)
* @param propertySet Property set
* @param modelName Model name (not null)
* @param modelDescription Model description
* @param modelReference Model reference
* @return Defined model name
*/
private static String defineModel(Swagger swagger, PropertySet<?> propertySet, String modelName,
String modelDescription, String modelReference) {
if (modelName != null) {
if (swagger == null) {
throw new SwaggerConfigurationException(
"Cannot define Model with name [" + modelName + "]: missing context Swagger instance");
}
ModelImpl model = new ModelImpl();
model.type(ModelImpl.OBJECT);
model.name(modelName);
model.setProperties(getPropertySetProperties(propertySet, true));
model.getVendorExtensions().put(SwaggerExtensions.MODEL_TYPE.getExtensionName(),
PropertyBox.class.getName());
if (modelDescription != null) {
model.description(modelDescription);
}
if (modelReference != null && !modelReference.trim().equals("")) {
model.setReference(modelReference);
}
// define
swagger.addDefinition(modelName, model);
return modelName;
}
return null;
}
示例2: build
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
public Model build() {
ModelImpl model = new ModelImpl();
model.setType(type);
Map<String, Property> properties = new HashMap<>();
for(Entry<String, PropertyBuilder> entry: propertyBuilders.entrySet()){
properties.put(entry.getKey(), entry.getValue().build());
}
model.setProperties(properties);
return model;
}
示例3: convertToSwaggerSchema
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
private Model convertToSwaggerSchema(Schema schema) {
ModelImpl docSchema = new ModelImpl();
Map<String, Property> fields = Maps.newLinkedHashMap();
if (!schema.fields().isEmpty()) {
for (Field f : schema.fields().values()) {
fields.put(f.name(), convertToSwaggerProperty(f));
}
docSchema.setProperties(fields);
}
if (!schema.enumValues().isEmpty()) {
docSchema._enum(schema.enumValues());
}
return docSchema;
}