user177800
user177800

Reputation:

Applying CGLib Proxy from a Annotation Processor

I have a working Annotation Processor that processes my custom annotation at compile time, I want to apply a CGLIB proxy to apply logic to some of the methods using MethodInterceptor, I have the two things working independently. I can't figure out how to apply the CGLIB code from the Annotation Processor.

What I want to do is to be able to Annotate a class with my custom annotation and have it automagically add the Enhancer code I have working applied to it so I don't have to manually apply the Enhancer code my self.

This seems like the perfect use case for Annotation Processing at compile time.

Upvotes: 1

Views: 597

Answers (1)

misl
misl

Reputation: 341

Have a look at http://projectlombok.org

That project does the same thing. However, unfortunately the implementation seems to be compiler dependent since they rely on com.sun.* classes. This makes it hard to run on JVM implementations of other vendors.

Upvotes: 1

Related Questions