Lombok - v0.10.1

lombok.javac
Class Javac

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

public class Javac
extends Object

Container for static utility methods relevant to lombok's operation on javac.


Method Summary
static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node)
          Checks if the Annotation AST Node provided is likely to be an instance of the provided annotation type.
static
<A extends Annotation>
AnnotationValues<A>
createAnnotation(Class<A> type, JavacNode node)
          Creates an instance of AnnotationValues for the provided AST Node.
static int getCtcInt(Class<?> ctcLocation, String identifier)
          Retrieves a compile time constant of type int from the specified class location.
static com.sun.tools.javac.tree.JCTree getGeneratedBy(com.sun.tools.javac.tree.JCTree node)
           
static boolean isGenerated(com.sun.tools.javac.tree.JCTree node)
           
static
<T extends com.sun.tools.javac.tree.JCTree>
T
recursiveSetGeneratedBy(T node, com.sun.tools.javac.tree.JCTree source)
           
static
<T extends com.sun.tools.javac.tree.JCTree>
T
setGeneratedBy(T node, com.sun.tools.javac.tree.JCTree source)
           
static boolean typeMatches(Class<?> type, JavacNode node, com.sun.tools.javac.tree.JCTree typeNode)
          Checks if the given TypeReference node is likely to be a reference to the provided class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

annotationTypeMatches

public static boolean annotationTypeMatches(Class<? extends Annotation> type,
                                            JavacNode node)
Checks if the Annotation AST Node provided is likely to be an instance of the provided annotation type.

Parameters:
type - An actual annotation type, such as lombok.Getter.class.
node - A Lombok AST node representing an annotation in source code.

typeMatches

public static boolean typeMatches(Class<?> type,
                                  JavacNode node,
                                  com.sun.tools.javac.tree.JCTree typeNode)
Checks if the given TypeReference node is likely to be a reference to the provided class.

Parameters:
type - An actual type. This method checks if typeNode is likely to be a reference to this type.
node - A Lombok AST node. Any node in the appropriate compilation unit will do (used to get access to import statements).
typeNode - A type reference to check.

createAnnotation

public static <A extends Annotation> AnnotationValues<A> createAnnotation(Class<A> type,
                                                                          JavacNode node)
Creates an instance of AnnotationValues for the provided AST Node.

Parameters:
type - An annotation class type, such as lombok.Getter.class.
node - A Lombok AST node representing an annotation in source code.

getCtcInt

public static int getCtcInt(Class<?> ctcLocation,
                            String identifier)
Retrieves a compile time constant of type int from the specified class location. Solves the problem of compile time constant inlining, resulting in lombok having the wrong value (javac compiler changes private api constants from time to time)

Parameters:
ctcLocation - location of the compile time constant
identifier - the name of the field of the compile time constant.

getGeneratedBy

public static com.sun.tools.javac.tree.JCTree getGeneratedBy(com.sun.tools.javac.tree.JCTree node)

isGenerated

public static boolean isGenerated(com.sun.tools.javac.tree.JCTree node)

recursiveSetGeneratedBy

public static <T extends com.sun.tools.javac.tree.JCTree> T recursiveSetGeneratedBy(T node,
                                                                                    com.sun.tools.javac.tree.JCTree source)

setGeneratedBy

public static <T extends com.sun.tools.javac.tree.JCTree> T setGeneratedBy(T node,
                                                                           com.sun.tools.javac.tree.JCTree source)

Lombok - v0.10.1

Copyright © 2009-2010 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans, licensed under the MIT licence.