Lombok - v0.9.3

lombok.javac
Class HandlerLibrary

java.lang.Object
  extended by lombok.javac.HandlerLibrary

public class HandlerLibrary
extends java.lang.Object

This class tracks 'handlers' and knows how to invoke them for any given AST node. This class can find the handlers (via SPI discovery) and will set up the given AST node, such as building an AnnotationValues instance.


Constructor Summary
HandlerLibrary(javax.annotation.processing.Messager messager)
          Creates a new HandlerLibrary that will report any problems or errors to the provided messager.
 
Method Summary
 void callASTVisitors(JavacAST ast)
          Will call all registered JavacASTVisitor instances.
 boolean handleAnnotation(com.sun.tools.javac.tree.JCTree.JCCompilationUnit unit, JavacNode node, com.sun.tools.javac.tree.JCTree.JCAnnotation annotation)
          Handles the provided annotation node by first finding a qualifying instance of JavacAnnotationHandler and if one exists, calling it with a freshly cooked up instance of AnnotationValues.
 void javacError(java.lang.String message)
          Generates an error in the Messager that was used to initialize this HandlerLibrary.
 void javacError(java.lang.String message, java.lang.Throwable t)
          Generates an error in the Messager that was used to initialize this HandlerLibrary.
 void javacWarning(java.lang.String message)
          Generates a warning in the Messager that was used to initialize this HandlerLibrary.
 void javacWarning(java.lang.String message, java.lang.Throwable t)
          Generates a warning in the Messager that was used to initialize this HandlerLibrary.
static HandlerLibrary load(javax.annotation.processing.Messager messager)
          Creates a new HandlerLibrary that will report any problems or errors to the provided messager, then uses SPI discovery to load all annotation and visitor based handlers so that future calls to the handle methods will defer to these handlers.
 void skipAllButPrintAST()
           
 void skipPrintAST()
          Lombok does not currently support triggering annotations in a specified order; the order is essentially random right now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerLibrary

public HandlerLibrary(javax.annotation.processing.Messager messager)
Creates a new HandlerLibrary that will report any problems or errors to the provided messager. You probably want to use load(Messager) instead.

Method Detail

load

public static HandlerLibrary load(javax.annotation.processing.Messager messager)
Creates a new HandlerLibrary that will report any problems or errors to the provided messager, then uses SPI discovery to load all annotation and visitor based handlers so that future calls to the handle methods will defer to these handlers.


javacWarning

public void javacWarning(java.lang.String message)
Generates a warning in the Messager that was used to initialize this HandlerLibrary.


javacWarning

public void javacWarning(java.lang.String message,
                         java.lang.Throwable t)
Generates a warning in the Messager that was used to initialize this HandlerLibrary.


javacError

public void javacError(java.lang.String message)
Generates an error in the Messager that was used to initialize this HandlerLibrary.


javacError

public void javacError(java.lang.String message,
                       java.lang.Throwable t)
Generates an error in the Messager that was used to initialize this HandlerLibrary.


handleAnnotation

public boolean handleAnnotation(com.sun.tools.javac.tree.JCTree.JCCompilationUnit unit,
                                JavacNode node,
                                com.sun.tools.javac.tree.JCTree.JCAnnotation annotation)
Handles the provided annotation node by first finding a qualifying instance of JavacAnnotationHandler and if one exists, calling it with a freshly cooked up instance of AnnotationValues. Note that depending on the printASTOnly flag, the PrintAST annotation will either be silently skipped, or everything that isn't PrintAST will be skipped. The HandlerLibrary will attempt to guess if the given annotation node represents a lombok annotation. For example, if lombok.* is in the import list, then this method will guess that Getter refers to lombok.Getter, presuming that HandleGetter has been loaded.

Parameters:
unit - The Compilation Unit that contains the Annotation AST Node.
node - The Lombok AST Node representing the Annotation AST Node.
annotation - 'node.get()' - convenience parameter.

callASTVisitors

public void callASTVisitors(JavacAST ast)
Will call all registered JavacASTVisitor instances.


skipPrintAST

public void skipPrintAST()
Lombok does not currently support triggering annotations in a specified order; the order is essentially random right now. This lack of order is particularly annoying for the PrintAST annotation, which is almost always intended to run last. Hence, this hack, which lets it in fact run last.

See Also:
skipAllButPrintAST()

skipAllButPrintAST

public void skipAllButPrintAST()
See Also:
skipPrintAST()

Lombok - v0.9.3

Copyright © 2009 Reinier Zwitserloot and Roel Spilker, licensed under the MIT licence.