Skip to content

Instantly share code, notes, and snippets.

@oehme
Last active August 29, 2015 14:10
Show Gist options
  • Save oehme/136f24167311087f7cfa to your computer and use it in GitHub Desktop.
Save oehme/136f24167311087f7cfa to your computer and use it in GitHub Desktop.
LogProcessor
@Target(TYPE)
@Active(LogProcessor)
annotation Log {
}
class LogProcessor extends AbstractClassProcessor {
override doTransform(MutableClassDeclaration cls, extension TransformationContext context) {
cls.addField("log") [
static = true
final = true
type = Logger.newTypeReference
initializer = '''
«Logger».getLogger("«cls.qualifiedName»")
'''
primarySourceElement = cls
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment