本文整理汇总了Java中io.swagger.models.ModelImpl.setName方法的典型用法代码示例。如果您正苦于以下问题:Java ModelImpl.setName方法的具体用法?Java ModelImpl.setName怎么用?Java ModelImpl.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.ModelImpl
的用法示例。
在下文中一共展示了ModelImpl.setName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getModel
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
public ModelImpl getModel(ServiceDocument template) {
String kind = getStrippedKind(template.documentKind);
ModelImpl model = (ModelImpl) this.byKind.get(kind);
if (model == null) {
model = load(template.documentDescription.propertyDescriptions.entrySet());
model.setName(getStrippedKind(template.documentKind));
this.byKind.put(kind, model);
}
return model;
}
示例3: refProperty
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
private RefProperty refProperty(PropertyDescription pd) {
String kind = getStrippedKind(pd.kind);
ModelImpl model = (ModelImpl) this.byKind.get(kind);
if (model == null) {
model = load(pd.fieldDescriptions.entrySet());
model.setName(kind);
this.byKind.put(kind, model);
}
return new RefProperty(kind);
}
示例4: testCreateObjectRefProperty
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
@Test
public void testCreateObjectRefProperty() {
ModelImpl innerModel = new ModelImpl();
innerModel.setName("Test");
Property property = SwaggerRefPropertyFactory.create(SwaggerRefPropertyFactory.PropertyContainerType.NONE, innerModel);
assertTrue(property instanceof RefProperty);
RefProperty refProperty = (RefProperty) property;
assertEquals(innerModel.getName(), refProperty.getSimpleRef());
}
示例5: testCreateArrayRefProperty
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
@Test
public void testCreateArrayRefProperty() {
ModelImpl innerModel = new ModelImpl();
innerModel.setName("Test");
Property property = SwaggerRefPropertyFactory.create(SwaggerRefPropertyFactory.PropertyContainerType.LIST, innerModel);
assertTrue(property instanceof ArrayProperty);
ArrayProperty arrayProperty = (ArrayProperty) property;
RefProperty refProperty = (RefProperty) arrayProperty.getItems();
assertEquals(innerModel.getName(), refProperty.getSimpleRef());
}
示例6: 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;
}