本文整理匯總了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());
}