use of javax.ws.rs.FormParam in project swagger-core by swagger-api.
the class DefaultParameterExtension method extractParameters.
@Override
public List<Parameter> extractParameters(List<Annotation> annotations, Type type, Set<Type> typesToSkip, Iterator<SwaggerExtension> chain) {
if (shouldIgnoreType(type, typesToSkip)) {
return new ArrayList<Parameter>();
}
List<Parameter> parameters = new ArrayList<Parameter>();
Parameter parameter = null;
for (Annotation annotation : annotations) {
if (annotation instanceof QueryParam) {
QueryParam param = (QueryParam) annotation;
QueryParameter qp = new QueryParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
qp.setProperty(schema);
}
parameter = qp;
} else if (annotation instanceof PathParam) {
PathParam param = (PathParam) annotation;
PathParameter pp = new PathParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
pp.setProperty(schema);
}
parameter = pp;
} else if (annotation instanceof HeaderParam) {
HeaderParam param = (HeaderParam) annotation;
HeaderParameter hp = new HeaderParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
hp.setProperty(schema);
}
parameter = hp;
} else if (annotation instanceof CookieParam) {
CookieParam param = (CookieParam) annotation;
CookieParameter cp = new CookieParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
cp.setProperty(schema);
}
parameter = cp;
} else if (annotation instanceof FormParam) {
FormParam param = (FormParam) annotation;
FormParameter fp = new FormParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
fp.setProperty(schema);
}
parameter = fp;
} else {
handleAdditionalAnnotation(parameters, annotation, type, typesToSkip);
}
}
if (parameter != null) {
parameters.add(parameter);
}
return parameters;
}
use of javax.ws.rs.FormParam in project tomee by apache.
the class ResourceUtils method getParameter.
// CHECKSTYLE:OFF
public static Parameter getParameter(int index, Annotation[] anns, Class<?> type) {
Context ctx = AnnotationUtils.getAnnotation(anns, Context.class);
if (ctx != null) {
return new Parameter(ParameterType.CONTEXT, index, null);
}
boolean isEncoded = AnnotationUtils.getAnnotation(anns, Encoded.class) != null;
BeanParam bp = AnnotationUtils.getAnnotation(anns, BeanParam.class);
if (bp != null) {
return new Parameter(ParameterType.BEAN, index, null, isEncoded, null);
}
String dValue = AnnotationUtils.getDefaultParameterValue(anns);
PathParam a = AnnotationUtils.getAnnotation(anns, PathParam.class);
if (a != null) {
return new Parameter(ParameterType.PATH, index, a.value(), isEncoded, dValue);
}
QueryParam q = AnnotationUtils.getAnnotation(anns, QueryParam.class);
if (q != null) {
return new Parameter(ParameterType.QUERY, index, q.value(), isEncoded, dValue);
}
MatrixParam m = AnnotationUtils.getAnnotation(anns, MatrixParam.class);
if (m != null) {
return new Parameter(ParameterType.MATRIX, index, m.value(), isEncoded, dValue);
}
FormParam f = AnnotationUtils.getAnnotation(anns, FormParam.class);
if (f != null) {
return new Parameter(ParameterType.FORM, index, f.value(), isEncoded, dValue);
}
HeaderParam h = AnnotationUtils.getAnnotation(anns, HeaderParam.class);
if (h != null) {
return new Parameter(ParameterType.HEADER, index, h.value(), isEncoded, dValue);
}
CookieParam c = AnnotationUtils.getAnnotation(anns, CookieParam.class);
if (c != null) {
return new Parameter(ParameterType.COOKIE, index, c.value(), isEncoded, dValue);
}
return new Parameter(ParameterType.REQUEST_BODY, index, null);
}
use of javax.ws.rs.FormParam in project cxf by apache.
the class ResourceUtils method getParameter.
// CHECKSTYLE:OFF
public static Parameter getParameter(int index, Annotation[] anns, Class<?> type) {
Context ctx = AnnotationUtils.getAnnotation(anns, Context.class);
if (ctx != null) {
return new Parameter(ParameterType.CONTEXT, index, null);
}
boolean isEncoded = AnnotationUtils.getAnnotation(anns, Encoded.class) != null;
BeanParam bp = AnnotationUtils.getAnnotation(anns, BeanParam.class);
if (bp != null) {
return new Parameter(ParameterType.BEAN, index, null, isEncoded, null);
}
String dValue = AnnotationUtils.getDefaultParameterValue(anns);
PathParam a = AnnotationUtils.getAnnotation(anns, PathParam.class);
if (a != null) {
return new Parameter(ParameterType.PATH, index, a.value(), isEncoded, dValue);
}
QueryParam q = AnnotationUtils.getAnnotation(anns, QueryParam.class);
if (q != null) {
return new Parameter(ParameterType.QUERY, index, q.value(), isEncoded, dValue);
}
MatrixParam m = AnnotationUtils.getAnnotation(anns, MatrixParam.class);
if (m != null) {
return new Parameter(ParameterType.MATRIX, index, m.value(), isEncoded, dValue);
}
FormParam f = AnnotationUtils.getAnnotation(anns, FormParam.class);
if (f != null) {
return new Parameter(ParameterType.FORM, index, f.value(), isEncoded, dValue);
}
HeaderParam h = AnnotationUtils.getAnnotation(anns, HeaderParam.class);
if (h != null) {
return new Parameter(ParameterType.HEADER, index, h.value(), isEncoded, dValue);
}
CookieParam c = AnnotationUtils.getAnnotation(anns, CookieParam.class);
if (c != null) {
return new Parameter(ParameterType.COOKIE, index, c.value(), isEncoded, dValue);
}
return new Parameter(ParameterType.REQUEST_BODY, index, null);
}
Aggregations