Groovy: Apply ToString transform to all classes in the package

时间:2017-08-04 13:01:01

标签: grails groovy transform aspectj abstract-syntax-tree

I have a Grails 2.3.7 application. All Command Objects(parameters to controller actions) are stored in a single package. I want to apply groovy.transform.ToString to all classes in this package, to avoid putting @ToString(includeNames=true) on every class. Further purpose is to create an aspect to log all controller actions, including implicit params object and command object.

Is that possible? How can i achieve that? Should I apply the AST transformation(org.codehaus.groovy.transform.ToStringASTTransformation) directly to classes found using reflection at application startup? Or should I dynamically add ToString annotation to metaclass during classloading / aplication startup?

0 个答案:

没有答案