com.dp4j.processors
Class DProcessor

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by com.dp4j.processors.DProcessor
All Implemented Interfaces:
Processor
Direct Known Subclasses:
BuilderProcessor, GetInstanceProcessor, InstanceProcessor, PrivateAccessProcessor, SingletonProcessor, TemplateMethodProcessor

public abstract class DProcessor
extends AbstractProcessor

Author:
simpatico

Field Summary
 String arrayBrac
           
static String clazz
           
protected  com.sun.tools.javac.model.JavacElements elementUtils
           
protected  TypeElement encClass
           
static String javaLangClass
           
protected  com.sun.tools.javac.tree.JCTree.JCMethodDecl methTree
           
protected  Messager msgr
           
protected  Map<String,String> options
           
protected  Resolver rs
           
protected  com.sun.tools.javac.code.Symtab symTable
           
protected  com.sun.tools.javac.tree.JCTree.JCExpression thisExp
           
protected  com.sun.tools.javac.tree.TreeMaker tm
           
protected  com.sun.source.util.Trees trees
           
protected  Types typeUtils
           
static String varArgsDots
           
protected  boolean verbose
           
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
DProcessor()
           
 
Method Summary
 boolean differentArg(com.sun.tools.javac.code.Type arg, com.sun.tools.javac.code.Type varSymbol)
           
<T> com.sun.tools.javac.util.List<T>
emptyList()
           
 com.sun.tools.javac.tree.JCTree.JCNewArray getArray(com.sun.tools.javac.code.Type t, com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> args)
           
 com.sun.tools.javac.tree.JCTree.JCNewArray getArray(com.sun.tools.javac.code.Type t, List<com.sun.tools.javac.tree.JCTree.JCExpression> args)
           
 com.sun.tools.javac.tree.JCTree.JCVariableDecl getArrayDecl(com.sun.tools.javac.tree.JCTree.JCModifiers mods, String varName, String idName, com.sun.tools.javac.tree.JCTree.JCNewArray array)
           
 com.sun.tools.javac.tree.JCTree.JCVariableDecl getArrayDecl(String varName, String idName, com.sun.tools.javac.tree.JCTree.JCNewArray array)
           
 com.sun.tools.javac.tree.JCTree.JCBlock getBlock(com.sun.tools.javac.tree.JCTree.JCStatement... stats)
           
 com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCCatch> getCatches(com.sun.source.tree.CompilationUnitTree cut, Node n, Collection<String> exceptions)
           
 com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCCatch> getCatches(com.sun.source.tree.CompilationUnitTree cut, Node n, String... exceptions)
           
 DeclaredType getDeclaredType(String className)
           
protected  Map<Element,TypeElement> getElementsAnnotated(RoundEnvironment roundEnv, Set<? extends TypeElement> annotations)
           
protected  com.sun.tools.javac.tree.JCTree.JCExpression getEmptyArgsConstructor(com.sun.tools.javac.code.Symbol.MethodSymbol sym)
           
 com.sun.tools.javac.tree.JCTree.JCExpression getId(com.sun.tools.javac.util.Name typeName)
           
 com.sun.tools.javac.tree.JCTree.JCExpression getId(String typeName)
           
protected  com.sun.tools.javac.tree.JCTree.JCExpression getIdAfterImporting(String methodName)
           
protected  com.sun.tools.javac.tree.JCTree.JCExpression getIdentAfterImporting(Class clazz)
           
 com.sun.tools.javac.tree.JCTree.JCIf getIfNull(com.sun.tools.javac.tree.JCTree.JCIdent id, com.sun.tools.javac.tree.JCTree.JCStatement thenStmt)
           
 com.sun.tools.javac.tree.JCTree.JCIf getIfNull(com.sun.tools.javac.util.Name name, com.sun.tools.javac.tree.JCTree.JCStatement thenStmt)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName, Boolean... boolParams)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName, com.sun.tools.javac.tree.JCTree.JCExpression... params)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName, com.sun.tools.javac.tree.JCTree.JCExpression param, com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> otherParams, Map<String,com.sun.tools.javac.tree.JCTree.JCExpression> vars, com.sun.source.tree.CompilationUnitTree cut, Object packageName, com.sun.source.tree.Scope scope, com.sun.tools.javac.tree.JCTree.JCStatement stmt, Collection<com.sun.tools.javac.code.Symbol> varSyms)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName, com.sun.tools.javac.util.Name... objs)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName, com.sun.tools.javac.util.Name stringParam, com.sun.tools.javac.tree.JCTree.JCExpression[] exps)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName, String... stringParams)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName, String param, com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> otherParams, Map<String,com.sun.tools.javac.tree.JCTree.JCExpression> vars, com.sun.source.tree.CompilationUnitTree cut, Object packageName, com.sun.source.tree.Scope scope, com.sun.tools.javac.tree.JCTree.JCStatement stmt, Collection<com.sun.tools.javac.code.Symbol> varSyms)
           
 List<com.sun.tools.javac.code.Symbol> getMethodsWithSameName(String mName, Collection<com.sun.tools.javac.code.Symbol> list)
           
 com.sun.tools.javac.tree.JCTree.JCLiteral getNull()
           
 com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> getParamsList(Boolean... params)
           
 com.sun.tools.javac.tree.JCTree.JCMethodInvocation getRefMethodInvoc(String methodName, Object param)
           
 Collection<com.sun.tools.javac.code.Symbol> getSmallerList(Collection<com.sun.tools.javac.code.Symbol> methodsWithSameName, com.sun.tools.javac.code.Symbol ms)
           
 Set<String> getSupportedOptions()
           
 SourceVersion getSupportedSourceVersion()
           
 com.sun.tools.javac.code.Symbol.ClassSymbol getTypeElement(String className)
           
 com.sun.tools.javac.tree.JCTree.JCExpression[] getTypes(List<? extends com.sun.tools.javac.code.Symbol> params)
           
 com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(com.sun.tools.javac.tree.JCTree.JCModifiers mods, String varName, String idName, String methodName, String... params)
           
 com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(String varName, String idName, String methodName, com.sun.tools.javac.util.Name stringParam, com.sun.tools.javac.tree.JCTree.JCExpression... params)
           
 com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(String varName, String idName, String methodName, String... params)
           
 com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(String varName, String idName, String methodName, String stringParam, com.sun.tools.javac.tree.JCTree.JCExpression[] params, Map<String,com.sun.tools.javac.tree.JCTree.JCExpression> vars, com.sun.source.tree.CompilationUnitTree cut, Object packageName, com.sun.source.tree.Scope scope, com.sun.tools.javac.tree.JCTree.JCStatement stmt, Collection<com.sun.tools.javac.code.Symbol> varSyms)
           
 void init(ProcessingEnvironment processingEnv)
           
protected
<T> com.sun.tools.javac.util.List<T>
injectBefore(T stmt, com.sun.tools.javac.util.List<? extends T> stats, T... newStmts)
           
protected  boolean isOnlyHandler(Set<? extends TypeElement> annotations)
           
protected static
<T> com.sun.tools.javac.util.List<T>
merge(Collection<T> stats, Collection<T> newStmts)
           
protected  void printMsg(String msg, Element e, boolean warningsOnly)
           
 void printVerbose(com.sun.source.tree.CompilationUnitTree cut, Element e)
           
 boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
           
protected abstract  void processElement(Element e, TypeElement ann, boolean warningsOnly)
           
protected
<T> com.sun.tools.javac.util.List<T>
replace(T stmt, com.sun.tools.javac.util.List<? extends T> stats, T... newStmts)
           
 com.sun.tools.javac.tree.JCTree.JCThrow throwException(String exception)
           
 void throwExceptions(Collection<String> exceptions)
           
 void throwExceptions(String... exceptions)
           
<T> com.sun.tools.javac.util.List<T>
toList(T... params)
           
<T> com.sun.tools.javac.util.List<String>
toString(List<T> params)
           
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clazz

public static final String clazz
See Also:
Constant Field Values

arrayBrac

public final String arrayBrac
See Also:
Constant Field Values

trees

protected com.sun.source.util.Trees trees

tm

protected com.sun.tools.javac.tree.TreeMaker tm

elementUtils

protected com.sun.tools.javac.model.JavacElements elementUtils

msgr

protected Messager msgr

typeUtils

protected Types typeUtils

symTable

protected com.sun.tools.javac.code.Symtab symTable

encClass

protected TypeElement encClass

rs

protected Resolver rs

methTree

protected com.sun.tools.javac.tree.JCTree.JCMethodDecl methTree

javaLangClass

public static final String javaLangClass
See Also:
Constant Field Values

varArgsDots

public static final String varArgsDots
See Also:
Constant Field Values

thisExp

protected com.sun.tools.javac.tree.JCTree.JCExpression thisExp

verbose

protected boolean verbose

options

protected Map<String,String> options
Constructor Detail

DProcessor

public DProcessor()
Method Detail

getSupportedOptions

public Set<String> getSupportedOptions()
Specified by:
getSupportedOptions in interface Processor
Overrides:
getSupportedOptions in class AbstractProcessor

getSupportedSourceVersion

public SourceVersion getSupportedSourceVersion()
Specified by:
getSupportedSourceVersion in interface Processor
Overrides:
getSupportedSourceVersion in class AbstractProcessor

getArray

public com.sun.tools.javac.tree.JCTree.JCNewArray getArray(com.sun.tools.javac.code.Type t,
                                                           com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> args)

getArray

public com.sun.tools.javac.tree.JCTree.JCNewArray getArray(com.sun.tools.javac.code.Type t,
                                                           List<com.sun.tools.javac.tree.JCTree.JCExpression> args)

printMsg

protected void printMsg(String msg,
                        Element e,
                        boolean warningsOnly)

getVarDecl

public com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(com.sun.tools.javac.tree.JCTree.JCModifiers mods,
                                                                 String varName,
                                                                 String idName,
                                                                 String methodName,
                                                                 String... params)

getVarDecl

public com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(String varName,
                                                                 String idName,
                                                                 String methodName,
                                                                 String... params)

getVarDecl

public com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(String varName,
                                                                 String idName,
                                                                 String methodName,
                                                                 com.sun.tools.javac.util.Name stringParam,
                                                                 com.sun.tools.javac.tree.JCTree.JCExpression... params)

getVarDecl

public com.sun.tools.javac.tree.JCTree.JCVariableDecl getVarDecl(String varName,
                                                                 String idName,
                                                                 String methodName,
                                                                 String stringParam,
                                                                 com.sun.tools.javac.tree.JCTree.JCExpression[] params,
                                                                 Map<String,com.sun.tools.javac.tree.JCTree.JCExpression> vars,
                                                                 com.sun.source.tree.CompilationUnitTree cut,
                                                                 Object packageName,
                                                                 com.sun.source.tree.Scope scope,
                                                                 com.sun.tools.javac.tree.JCTree.JCStatement stmt,
                                                                 Collection<com.sun.tools.javac.code.Symbol> varSyms)

getArrayDecl

public com.sun.tools.javac.tree.JCTree.JCVariableDecl getArrayDecl(com.sun.tools.javac.tree.JCTree.JCModifiers mods,
                                                                   String varName,
                                                                   String idName,
                                                                   com.sun.tools.javac.tree.JCTree.JCNewArray array)

getArrayDecl

public com.sun.tools.javac.tree.JCTree.JCVariableDecl getArrayDecl(String varName,
                                                                   String idName,
                                                                   com.sun.tools.javac.tree.JCTree.JCNewArray array)

getParamsList

public com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> getParamsList(Boolean... params)

toList

public <T> com.sun.tools.javac.util.List<T> toList(T... params)

getTypes

public com.sun.tools.javac.tree.JCTree.JCExpression[] getTypes(List<? extends com.sun.tools.javac.code.Symbol> params)

getMethodsWithSameName

public List<com.sun.tools.javac.code.Symbol> getMethodsWithSameName(String mName,
                                                                    Collection<com.sun.tools.javac.code.Symbol> list)

getMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName,
                                                                         com.sun.tools.javac.tree.JCTree.JCExpression param,
                                                                         com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> otherParams,
                                                                         Map<String,com.sun.tools.javac.tree.JCTree.JCExpression> vars,
                                                                         com.sun.source.tree.CompilationUnitTree cut,
                                                                         Object packageName,
                                                                         com.sun.source.tree.Scope scope,
                                                                         com.sun.tools.javac.tree.JCTree.JCStatement stmt,
                                                                         Collection<com.sun.tools.javac.code.Symbol> varSyms)

getMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName,
                                                                         String param,
                                                                         com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> otherParams,
                                                                         Map<String,com.sun.tools.javac.tree.JCTree.JCExpression> vars,
                                                                         com.sun.source.tree.CompilationUnitTree cut,
                                                                         Object packageName,
                                                                         com.sun.source.tree.Scope scope,
                                                                         com.sun.tools.javac.tree.JCTree.JCStatement stmt,
                                                                         Collection<com.sun.tools.javac.code.Symbol> varSyms)

getRefMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getRefMethodInvoc(String methodName,
                                                                            Object param)

getMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName,
                                                                         com.sun.tools.javac.tree.JCTree.JCExpression... params)

getMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName,
                                                                         com.sun.tools.javac.util.Name stringParam,
                                                                         com.sun.tools.javac.tree.JCTree.JCExpression[] exps)

getMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName,
                                                                         Boolean... boolParams)

getMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName,
                                                                         com.sun.tools.javac.util.Name... objs)

getMethodInvoc

public com.sun.tools.javac.tree.JCTree.JCMethodInvocation getMethodInvoc(String methodName,
                                                                         String... stringParams)

getId

public com.sun.tools.javac.tree.JCTree.JCExpression getId(String typeName)

getId

public com.sun.tools.javac.tree.JCTree.JCExpression getId(com.sun.tools.javac.util.Name typeName)

init

public void init(ProcessingEnvironment processingEnv)
Specified by:
init in interface Processor
Overrides:
init in class AbstractProcessor

getElementsAnnotated

protected Map<Element,TypeElement> getElementsAnnotated(RoundEnvironment roundEnv,
                                                        Set<? extends TypeElement> annotations)

process

@templateMethod
public boolean process(Set<? extends TypeElement> annotations,
                                      RoundEnvironment roundEnv)
Specified by:
process in interface Processor
Specified by:
process in class AbstractProcessor

isOnlyHandler

protected boolean isOnlyHandler(Set<? extends TypeElement> annotations)

getIdentAfterImporting

protected com.sun.tools.javac.tree.JCTree.JCExpression getIdentAfterImporting(Class clazz)

getIdAfterImporting

protected com.sun.tools.javac.tree.JCTree.JCExpression getIdAfterImporting(String methodName)

emptyList

public <T> com.sun.tools.javac.util.List<T> emptyList()

injectBefore

protected <T> com.sun.tools.javac.util.List<T> injectBefore(T stmt,
                                                            com.sun.tools.javac.util.List<? extends T> stats,
                                                            T... newStmts)

replace

protected <T> com.sun.tools.javac.util.List<T> replace(T stmt,
                                                       com.sun.tools.javac.util.List<? extends T> stats,
                                                       T... newStmts)

merge

protected static <T> com.sun.tools.javac.util.List<T> merge(Collection<T> stats,
                                                            Collection<T> newStmts)

toString

public <T> com.sun.tools.javac.util.List<String> toString(List<T> params)

processElement

protected abstract void processElement(Element e,
                                       TypeElement ann,
                                       boolean warningsOnly)

getDeclaredType

public DeclaredType getDeclaredType(String className)

getTypeElement

public com.sun.tools.javac.code.Symbol.ClassSymbol getTypeElement(String className)

differentArg

public boolean differentArg(com.sun.tools.javac.code.Type arg,
                            com.sun.tools.javac.code.Type varSymbol)

getSmallerList

public Collection<com.sun.tools.javac.code.Symbol> getSmallerList(Collection<com.sun.tools.javac.code.Symbol> methodsWithSameName,
                                                                  com.sun.tools.javac.code.Symbol ms)

printVerbose

public void printVerbose(com.sun.source.tree.CompilationUnitTree cut,
                         Element e)

getNull

public com.sun.tools.javac.tree.JCTree.JCLiteral getNull()

getIfNull

public com.sun.tools.javac.tree.JCTree.JCIf getIfNull(com.sun.tools.javac.tree.JCTree.JCIdent id,
                                                      com.sun.tools.javac.tree.JCTree.JCStatement thenStmt)

getIfNull

public com.sun.tools.javac.tree.JCTree.JCIf getIfNull(com.sun.tools.javac.util.Name name,
                                                      com.sun.tools.javac.tree.JCTree.JCStatement thenStmt)

getBlock

public com.sun.tools.javac.tree.JCTree.JCBlock getBlock(com.sun.tools.javac.tree.JCTree.JCStatement... stats)

getCatches

public com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCCatch> getCatches(com.sun.source.tree.CompilationUnitTree cut,
                                                                                         Node n,
                                                                                         String... exceptions)

getCatches

public com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCCatch> getCatches(com.sun.source.tree.CompilationUnitTree cut,
                                                                                         Node n,
                                                                                         Collection<String> exceptions)

getEmptyArgsConstructor

protected com.sun.tools.javac.tree.JCTree.JCExpression getEmptyArgsConstructor(com.sun.tools.javac.code.Symbol.MethodSymbol sym)

throwException

public com.sun.tools.javac.tree.JCTree.JCThrow throwException(String exception)

throwExceptions

public void throwExceptions(Collection<String> exceptions)

throwExceptions

public void throwExceptions(String... exceptions)


Copyright © 2011. All Rights Reserved.