本文整理汇总了Java中io.swagger.annotations.ApiModel类的典型用法代码示例。如果您正苦于以下问题:Java ApiModel类的具体用法?Java ApiModel怎么用?Java ApiModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApiModel类属于io.swagger.annotations包,在下文中一共展示了ApiModel类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findPropertyDescription
import io.swagger.annotations.ApiModel; //导入依赖的package包/类
@Override
public String findPropertyDescription(Annotated a)
{
ApiParam apiParam = a.getAnnotation(ApiParam.class);
if (apiParam != null) {
return apiParam.description();
}
ApiModel model = a.getAnnotation(ApiModel.class);
if (model != null && !"".equals(model.description())) {
return model.description();
}
ApiModelProperty prop = a.getAnnotation(ApiModelProperty.class);
if (prop != null) {
return prop.value();
}
return null;
}
示例2: findSubtypes
import io.swagger.annotations.ApiModel; //导入依赖的package包/类
@Override
public List<NamedType> findSubtypes(Annotated a)
{
final ApiModel api = a.getAnnotation(ApiModel.class);
if (api != null) {
final Class<?>[] classes = api.subTypes();
final List<NamedType> names = new ArrayList<>(classes.length);
for (Class<?> subType : classes) {
names.add(new NamedType(subType));
}
if (!names.isEmpty()) {
return names;
}
}
return Collections.emptyList();
}
示例3: findRootName
import io.swagger.annotations.ApiModel; //导入依赖的package包/类
@Override
public PropertyName findRootName(AnnotatedClass ac) {
ApiModel model = ac.getAnnotation(ApiModel.class);
if (model != null) {
return new PropertyName(model.value());
} else {
return super.findRootName(ac);
}
}
示例4: process
import io.swagger.annotations.ApiModel; //导入依赖的package包/类
@Override
public void process(final CtClass<?> element) {
final CtAnnotation<Annotation> annotation = getFactory().Code().createAnnotation(getFactory().Code().createCtTypeReference(ApiModel.class));
element.addAnnotation(annotation);
log.debug("Add ApiModel to {}", element.getQualifiedName());
}
示例5: calculateTypeName
import io.swagger.annotations.ApiModel; //导入依赖的package包/类
public static String calculateTypeName(Class<?> parameterType) {
String typeName = typeNameByClass.get(parameterType);
if (typeName != null) {
return typeName;
}
if (parameterType.isPrimitive() || parameterType.getPackage().getName().equals("java.lang")) {
return "string";
}
if (parameterType.getName().equals("com.sun.jersey.multipart.MultiPart")) {
return "File";
}
ApiModel apiModel = parameterType.getAnnotation(ApiModel.class);
typeName = apiModel == null ? null : Strings.emptyToNull(apiModel.value());
return MoreObjects.firstNonNull(typeName, parameterType.getSimpleName());
}