Java 类io.swagger.annotations.ApiModel 实例源码

项目:netty-rest    文件:SwaggerJacksonAnnotationIntrospector.java   
@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;
}
项目:netty-rest    文件:SwaggerJacksonAnnotationIntrospector.java   
@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();
}
项目:swagger-maven-plugin    文件:EnhancedSwaggerAnnotationIntrospector.java   
@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);
    }
}
项目:camunda-bpm-swagger    文件:ApiModelProcessor.java   
@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());
}
项目:swagger-jaxrs-maven    文件:ApiTypes.java   
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());
}