What I am trying to do is basically match a class's field with an annotaion and them intercept the field's getter and setter.
public class Foo { @Sensitive private String Blah; Here is the code for my agent:
private static AgentBuilder createAgent() { return new AgentBuilder .Default() .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .type(ElementMatchers.is(FieldTypeMatcher.class).and(ElementMatchers.isAnnotatedWith(Foo.class))) .transform(((builder, typeDescription, classLoader, module) -> builder .method(method -> method.getActualName().contains(typeDescription.getActualName())) .intercept(Advice.to(Interceptor.class)) )); } I though I could match the field's name with the method's signature but I had no luck.