I am working on a project where I need access method arguments during execution. Is it possible to print method arguments using byte buddy framework? any sample code on this using javaagent is highly appreciated.
Yes, this is possible. You can use MethodDelegation
or Advice
to inject your code and then use the @AllArguments
annotation to get hold of the actual arguments.
The question is, how do you create your code in your project? You can either use a Java agent with the AgentBuilder
or create proxy subclasses using ByteBuddy
instances. Refer to the documentation and the mentioned classes javadoc to find out how this is done.