mercredi 7 décembre 2016

Java Annotation Processing

Trying to understand the difference between these 2 approaches

MethodSignature signature = (MethodSignature) joinPoint.getSignature();  
Abc abc = methodSignature.getMethod().getAnnotation(Abc.class);

vs

MethodSignature signature = (MethodSignature) joinPoint.getSignature();  
String methodName = signature.getMethod().getName();  
Class<?>[] parameterTypes = signature.getMethod().getParameterTypes();  
Abc abc = joinPoint.getTarget().getClass().getMethod(methodName,   parameterTypes).getAnnotation(Abc.class);

when would result of these approaches be different





Aucun commentaire:

Enregistrer un commentaire