I need to get the annotation (a value inside of it) of the declaring class of a method during intercept()
:
@RuntimeType
public static Object intercept(@SuperCall Callable callable, @Origin Method method) throws Exception {
method.getDeclaringClass().getDeclaredAnnotation(SomeAnnotationOnClass.class)
The last line returns null.
new AgentBuilder.Default().with(AgentBuilder.Listener.StreamWriting.toSystemOut()).type(ElementMatchers.isAnnotatedWith(SomeAnnotationOnClass.class))
.transform((builder, type, clazzLoader, javaModule) -> {
return builder.method(ElementMatchers.any()).intercept(MethodDelegation.to(MyInterceptor.class));
This works though... So the annotation is present (on class level!). But not when intercept()
is called
Aucun commentaire:
Enregistrer un commentaire