com.sun.tools.apt.mirror.declaration
Class DeclarationMaker

java.lang.Object
  extended by com.sun.tools.apt.mirror.declaration.DeclarationMaker

public class DeclarationMaker
extends java.lang.Object

Utilities for constructing and caching declarations.


Field Summary
private  Context context
           
private static Context.Key<DeclarationMaker> declarationMakerKey
           
private  AptEnv env
           
private  java.util.Map<Symbol.MethodSymbol,ExecutableDeclaration> executableDecls
           
private  java.util.Map<Symbol.VarSymbol,FieldDeclaration> fieldDecls
           
private  JavaCompiler javacompiler
           
private  java.util.Map<Symbol.PackageSymbol,PackageDeclaration> packageDecls
           
private  java.util.Map<Symbol.ClassSymbol,TypeDeclaration> typeDecls
           
 
Constructor Summary
private DeclarationMaker(Context context)
           
 
Method Summary
(package private)  AnnotationMirror getAnnotationMirror(Attribute.Compound a, Declaration decl)
          Returns an annotation.
(package private)  ExecutableDeclaration getExecutableDeclaration(Symbol.MethodSymbol m)
          Returns the method or constructor declaration for a method symbol.
(package private)  FieldDeclaration getFieldDeclaration(Symbol.VarSymbol v)
          Returns the field declaration for a var symbol.
 PackageDeclaration getPackageDeclaration(java.lang.String name)
          Returns the package declaration for the package with the given name.
 PackageDeclaration getPackageDeclaration(Symbol.PackageSymbol p)
          Returns the package declaration for a package symbol.
(package private)  ParameterDeclaration getParameterDeclaration(Symbol.VarSymbol v)
          Returns a parameter declaration.
 TypeDeclaration getTypeDeclaration(java.lang.String name)
          Returns the type declaration for the type with the given canonical name.
 TypeDeclaration getTypeDeclaration(Symbol.ClassSymbol c)
          Returns the type declaration for a class symbol.
 TypeParameterDeclaration getTypeParameterDeclaration(Symbol.TypeSymbol t)
          Returns a type parameter declaration.
private static boolean hasFlag(Symbol s, long flag)
          Does a symbol have a given flag?
static DeclarationMaker instance(Context context)
           
private static boolean isAnnotationTypeElement(Symbol.MethodSymbol m)
          Is a method an annotation type element? It is if it's declared in an annotation type.
static boolean isJavaIdentifier(java.lang.String id)
          Is a string a valid Java identifier?
static boolean isJavaName(java.lang.String name)
           
private  Symbol nameToSymbol(java.lang.String name, boolean classCache)
          Returns a symbol given the type's or packages's canonical name, or null if the name isn't found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

private AptEnv env

context

private Context context

javacompiler

private JavaCompiler javacompiler

declarationMakerKey

private static final Context.Key<DeclarationMaker> declarationMakerKey

packageDecls

private java.util.Map<Symbol.PackageSymbol,PackageDeclaration> packageDecls

typeDecls

private java.util.Map<Symbol.ClassSymbol,TypeDeclaration> typeDecls

executableDecls

private java.util.Map<Symbol.MethodSymbol,ExecutableDeclaration> executableDecls

fieldDecls

private java.util.Map<Symbol.VarSymbol,FieldDeclaration> fieldDecls
Constructor Detail

DeclarationMaker

private DeclarationMaker(Context context)
Method Detail

instance

public static DeclarationMaker instance(Context context)

getPackageDeclaration

public PackageDeclaration getPackageDeclaration(Symbol.PackageSymbol p)
Returns the package declaration for a package symbol.


getPackageDeclaration

public PackageDeclaration getPackageDeclaration(java.lang.String name)
Returns the package declaration for the package with the given name. Name is fully-qualified, or "" for the unnamed package. Returns null if package declaration not found.


getTypeDeclaration

public TypeDeclaration getTypeDeclaration(Symbol.ClassSymbol c)
Returns the type declaration for a class symbol. Forces completion, and returns null on error.


getTypeDeclaration

public TypeDeclaration getTypeDeclaration(java.lang.String name)
Returns the type declaration for the type with the given canonical name. Returns null if type declaration not found.


nameToSymbol

private Symbol nameToSymbol(java.lang.String name,
                            boolean classCache)
Returns a symbol given the type's or packages's canonical name, or null if the name isn't found.


getExecutableDeclaration

ExecutableDeclaration getExecutableDeclaration(Symbol.MethodSymbol m)
Returns the method or constructor declaration for a method symbol.


getFieldDeclaration

FieldDeclaration getFieldDeclaration(Symbol.VarSymbol v)
Returns the field declaration for a var symbol.


getParameterDeclaration

ParameterDeclaration getParameterDeclaration(Symbol.VarSymbol v)
Returns a parameter declaration.


getTypeParameterDeclaration

public TypeParameterDeclaration getTypeParameterDeclaration(Symbol.TypeSymbol t)
Returns a type parameter declaration.


getAnnotationMirror

AnnotationMirror getAnnotationMirror(Attribute.Compound a,
                                     Declaration decl)
Returns an annotation.


isJavaIdentifier

public static boolean isJavaIdentifier(java.lang.String id)
Is a string a valid Java identifier?


isJavaName

public static boolean isJavaName(java.lang.String name)

isAnnotationTypeElement

private static boolean isAnnotationTypeElement(Symbol.MethodSymbol m)
Is a method an annotation type element? It is if it's declared in an annotation type.


hasFlag

private static boolean hasFlag(Symbol s,
                               long flag)
Does a symbol have a given flag?