本文整理汇总了Java中io.swagger.models.ModelImpl.getReference方法的典型用法代码示例。如果您正苦于以下问题:Java ModelImpl.getReference方法的具体用法?Java ModelImpl.getReference怎么用?Java ModelImpl.getReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.ModelImpl
的用法示例。
在下文中一共展示了ModelImpl.getReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doConvert
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
@Override
public JavaType doConvert(ClassLoader classLoader, String packageName, Swagger swagger, Object model) {
ModelImpl modelImpl = (ModelImpl) model;
JavaType javaType = ConverterMgr.findJavaType(modelImpl.getType(), modelImpl.getFormat());
if (javaType != null) {
return javaType;
}
if (modelImpl.getReference() != null) {
return ConverterMgr.findByRef(classLoader, packageName, swagger, modelImpl.getReference());
}
if (modelImpl.getAdditionalProperties() != null) {
return MapPropertyConverter.findJavaType(classLoader,
packageName,
swagger,
modelImpl.getAdditionalProperties());
}
if (ObjectProperty.TYPE.equals(modelImpl.getType())
&& modelImpl.getProperties() == null
&& modelImpl.getName() == null) {
return TypeFactory.defaultInstance().constructType(Object.class);
}
// 根据name、property动态生成class
if (packageName == null) {
throw new Error("packageName should not be null");
}
String clsName = packageName + "." + modelImpl.getName();
Class<?> cls =
ClassUtils.getOrCreateClass(classLoader, packageName, swagger, modelImpl.getProperties(), clsName);
return TypeFactory.defaultInstance().constructType(cls);
}
示例2: createObjectRefProperty
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
private static RefProperty createObjectRefProperty(ModelImpl innerModel) {
return new RefProperty(!StringUtils.isEmpty(innerModel.getReference()) ? innerModel.getReference() : innerModel.getName());
}