public static Parameter getParameter(int index, Annotation[] anns) {
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;
String dValue = AnnotationUtils.getDefaultParameterValue(anns);
Parameter p = null;
PathParam a = AnnotationUtils.getAnnotation(anns, PathParam.class);
if (a != null) {
p = new Parameter(ParameterType.PATH, index, a.value(), isEncoded, dValue);
}
if (p == null) {
QueryParam q = AnnotationUtils.getAnnotation(anns, QueryParam.class);
if (q != null) {
p = new Parameter(ParameterType.QUERY, index, q.value(), isEncoded, dValue);
}
}
if (p != null) {
return p;
}
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);
}
p = null;
CookieParam c = AnnotationUtils.getAnnotation(anns, CookieParam.class);
if (c != null) {
p = new Parameter(ParameterType.COOKIE, index, c.value(), isEncoded, dValue);
} else {
p = new Parameter(ParameterType.REQUEST_BODY, index, null);
}
return p;
}