List<Object> argVals = new ArrayList<Object>();
Annotation[][] annos = method.getParameterAnnotations();
for (Annotation[] ans : annos) {
PathParam pathParam = null;
QueryParam queryParam = null;
for (Annotation an : ans) {
if (an instanceof PathParam)
pathParam = (PathParam) an;
else if (an instanceof QueryParam)
queryParam = (QueryParam) an;
}
if (pathParam != null) {
Object v = extractedArgs.get(pathParam.value());
if (v != null)
argVals.add(v);
else
throw new IllegalArgumentException("can not find annotation value for argument "
+ pathParam.value() + "in " + targetClass + "#" + method);
} else if (queryParam != null) {
String queryString = r.getQueryString(queryParam.value());
argVals.add(queryString); // string type conversion?
} else
throw new IllegalArgumentException(
"can not find an appropriate JAX-RC annotation for an argument for method:" + targetClass
+ "#" + method);