本文整理汇总了Java中io.swagger.models.ModelImpl.setType方法的典型用法代码示例。如果您正苦于以下问题:Java ModelImpl.setType方法的具体用法?Java ModelImpl.setType怎么用?Java ModelImpl.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.ModelImpl
的用法示例。
在下文中一共展示了ModelImpl.setType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toRefModel
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
private RefModel toRefModel(String modelType) {
if (RefProperty.class.isInstance(property)) {
return (RefModel) PropertyBuilder.toModel(property);
}
ModelImpl modelImpl = new ModelImpl();
modelImpl.setType("object");
modelImpl.setName(name);
modelImpl.addProperty(name, property);
operationGenerator.getSwagger().addDefinition(modelType, modelImpl);
RefModel refModel = new RefModel();
refModel.setReference("#/definitions/" + modelType);
return refModel;
}
示例2: createBodyParameter
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
private List<Parameter> createBodyParameter(String object) {
BodyParameter bodyParameter = new BodyParameter();
ModelImpl schema = new ModelImpl();
schema.setType(object);
bodyParameter.setSchema(schema);
List<Parameter> parameters = new ArrayList<>();
parameters.add(bodyParameter);
return parameters;
}
示例3: 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;
}
示例4: processListsFromProperties
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
private Map<String, Model> processListsFromProperties(Collection<Property> properties, Model baseModel, Swagger swagger) {
Map<String, Model> result = new LinkedHashMap<>();
for (Property p : properties) {
if (p != null && "array".equals(p.getType())) {
ArrayProperty arrayProperty = (ArrayProperty) p;
if ( arrayProperty.getItems() instanceof RefProperty) {
RefProperty ref = (RefProperty) arrayProperty.getItems();
String baseName = ref.getSimpleRef();
// Do not generate List wrappers for primitives (or strings)
if (!languageSpecificPrimitives.contains(baseName) && topLevelResources.contains(baseName)) {
String modelName = baseName + "List";
ModelImpl model = new ModelImpl();
model.setName(modelName);
model.setAllowEmptyValue(false);
model.setDescription("Collection List for " + baseName);
if (baseModel == null) {
baseModel = swagger.getDefinitions().get(baseName);
}
// only add the tags from the base model
if (baseModel.getVendorExtensions().containsKey("x-okta-tags")) {
model.setVendorExtension("x-okta-tags", baseModel.getVendorExtensions().get("x-okta-tags"));
}
model.setVendorExtension("x-isResourceList", true);
model.setVendorExtension("x-baseType", baseName);
model.setType(modelName);
result.put(modelName, model);
}
}
}
}
return result;
}