vendredi 3 avril 2015

Reflection geting value from method argument annotation

Sample code:



public interface TestClass {

@AnnoTest
public Object getTestObject( @AnnoTestArg("id") Integer postId );

}


How can i get value from @AnnoTestArg annotation ? I know how to check is argument annotated but, i can't check annotation value.


That's my code:



public void build(...) {
Annotation[][] anno = pm.getMethod().getParameterAnnotations();

for( Annotation a : anno[argNumber] ) {
if( a.equals(AnnoTestArg.class) ) {
// value ?
}
}


return connector;
}





Aucun commentaire:

Enregistrer un commentaire