How do I obtain the annotation from a parameter within the constructor arguments. I have tried…
Class<?>[] params = constructor.getParameterTypes();
if(params.length > 0) {
paramValues = new Object[params.length];
for(int i=0; i<params.length; i++) {
Annotation[] constructorAnnotations = params[i].getAnnotations(); //This does not work.
}
}
constructor.getParameterAnnotations()returns the annotations for each parameter. For example, the annotations for the 2nd parameter are: