byte-buddy icon indicating copy to clipboard operation
byte-buddy copied to clipboard

How to write a method ElementMatcher only include declared method ?

Open BlackBAKA opened this issue 3 years ago • 1 comments

For example,there are two class: ` public class Father { public void hi () {} }

public class Son extends Father { public void bye () {} }

`

How to build a ElementMatcher<MethodDescription> only include Son#bye(), thanks for your help.

BlackBAKA avatar Jul 09 '22 07:07 BlackBAKA

You'd need a matcher for the type (assuming you are using an agent builder) and then match the method. If you know the names, you can match both by name.

raphw avatar Jul 09 '22 17:07 raphw