Is there any free library to generate AspectJ code at compile-time (at the annotation processing step for example)? I am looking for something similar to codemodel, but to generate AspectJ code.
It does not seem like such a library is available.
After doing more reading and analyzing codemodel's source code:
Generating pure AspectJ code with codemodel is not possible, since one cannot declare something like:
public aspect TransactionManager { ... }
It is not possible to twist the JDeclaredClass item properly to solve 1. You would have to rewrite almost everything from scratch
AspectJ5 introduces annotations, meaning we can declare aspects in pure Java:
@Aspect public class TransactionManager { ... }
The only really tricky part of @AspectJ seems to be Inter-type Declarations, but a good/viable solution is provided here.
Conclusion: It does not seem like a specific library to generate AspectJ code is necessary, one can rely on codemodel only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With