lombok.javac
Interface JavacAnnotationHandler<T extends java.lang.annotation.Annotation>
- All Known Implementing Classes:
- HandleCleanup, HandleConstructor.HandleAllArgsConstructor, HandleConstructor.HandleNoArgsConstructor, HandleConstructor.HandleRequiredArgsConstructor, HandleData, HandleEqualsAndHashCode, HandleGetter, HandlePrintAST, HandleSetter, HandleSneakyThrows, HandleSynchronized, HandleToString
public interface JavacAnnotationHandler<T extends java.lang.annotation.Annotation>
Implement this interface if you want to be triggered for a specific annotation.
You MUST replace 'T' with a specific annotation type, such as:
public class HandleGetter implements JavacAnnotationHandler<Getter>
Because this generics parameter is inspected to figure out which class you're interested in.
You also need to register yourself via SPI discovery as being an implementation of JavacAnnotationHandler.
|
Method Summary |
boolean |
handle(AnnotationValues<T> annotation,
com.sun.tools.javac.tree.JCTree.JCAnnotation ast,
JavacNode annotationNode)
Called when an annotation is found that is likely to match the annotation you're interested in. |
handle
boolean handle(AnnotationValues<T> annotation,
com.sun.tools.javac.tree.JCTree.JCAnnotation ast,
JavacNode annotationNode)
- Called when an annotation is found that is likely to match the annotation you're interested in.
Be aware that you'll be called for ANY annotation node in the source that looks like a match. There is,
for example, no guarantee that the annotation node belongs to a method, even if you set your
TargetType in the annotation to methods only.
- Parameters:
annotation - The actual annotation - use this object to retrieve the annotation parameters.ast - The javac AST node representing the annotation.annotationNode - The Lombok AST wrapper around the 'ast' parameter. You can use this object
to travel back up the chain (something javac AST can't do) to the parent of the annotation, as well
as access useful methods such as generating warnings or errors focused on the annotation.
- Returns:
true if you don't want to be called again about this annotation during this
compile session (you've handled it), or false to indicate you aren't done yet.
Copyright © 2009 Reinier Zwitserloot and Roel Spilker, licensed under the MIT licence.