1
私はintercept()
中にメソッドの宣言クラスの注釈(その中の値)を取得する必要があります。ByteBuddy - )(切片内の宣言クラスの注釈を取得
@RuntimeType
public static Object intercept(@SuperCall Callable callable, @Origin Method method) throws Exception {
method.getDeclaringClass().getDeclaredAnnotation(SomeAnnotationOnClass.class);
最後の行は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));
これは動作します...注釈は存在します(クラスレベルで!)。ただし、intercept()
が呼び出されたときではありません。
ありがとう! AgentBuilderを使用しているときに、ParameterBinder.ForFixedValueに変換をバインドする方法に関するドキュメントはありますか? 何も見つかりませんでした。 – Reymanx
javadocがあなたを助けることができるように私は何を望んでいますか?このために 'MethodDelegation.withCustomBinding()。bind(...)。to(...)'を使用しています。 –