public class Resolver
extends java.lang.Object
Constructor and Description |
---|
Resolver(javax.annotation.processing.ProcessingEnvironment env) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
buildMethodContext()
Build an instance of
Resolve$MethodResolutionContext . |
javax.lang.model.element.Element |
findClass(java.lang.String name,
com.sun.source.util.TreePath path)
Finds the class literal with name
name . |
com.sun.tools.javac.code.Symbol.ClassSymbol |
findClassInPackage(java.lang.String name,
com.sun.tools.javac.code.Symbol.PackageSymbol pck,
com.sun.source.util.TreePath path)
Finds the class with name
name in a given package. |
javax.lang.model.element.VariableElement |
findField(java.lang.String name,
javax.lang.model.type.TypeMirror type,
com.sun.source.util.TreePath path)
Finds the field with name
name in a given type. |
javax.lang.model.element.VariableElement |
findLocalVariableOrParameterOrField(java.lang.String name,
com.sun.source.util.TreePath path)
Finds the local variable with name
name in the given scope. |
javax.lang.model.element.Element |
findMethod(java.lang.String methodName,
javax.lang.model.type.TypeMirror receiverType,
com.sun.source.util.TreePath path,
java.util.List<javax.lang.model.type.TypeMirror> argumentTypes)
Finds the method element for a given name and list of expected parameter types.
|
com.sun.tools.javac.code.Symbol.PackageSymbol |
findPackage(java.lang.String name,
com.sun.source.util.TreePath path)
Finds the package with name
name . |
com.sun.tools.javac.comp.Env<com.sun.tools.javac.comp.AttrContext> |
getEnvForPath(com.sun.source.util.TreePath path)
Determine the environment for the given path.
|
public com.sun.tools.javac.comp.Env<com.sun.tools.javac.comp.AttrContext> getEnvForPath(com.sun.source.util.TreePath path)
path
- the tree path to the local scopepublic com.sun.tools.javac.code.Symbol.PackageSymbol findPackage(java.lang.String name, com.sun.source.util.TreePath path)
name
.name
- the name of the packagepath
- the tree path to the local scopePackageSymbol
for the package if it is found, null
otherwisepublic javax.lang.model.element.VariableElement findField(java.lang.String name, javax.lang.model.type.TypeMirror type, com.sun.source.util.TreePath path)
name
in a given type.
The method adheres to all the rules of Java's scoping (while also considering the imports) for name resolution.
name
- the name of the fieldtype
- the type of the receiver (i.e., the type in which to look for the field).path
- the tree path to the local scopepublic javax.lang.model.element.VariableElement findLocalVariableOrParameterOrField(java.lang.String name, com.sun.source.util.TreePath path)
name
in the given scope.name
- the name of the local variablepath
- the tree path to the local scopepublic javax.lang.model.element.Element findClass(java.lang.String name, com.sun.source.util.TreePath path)
name
.
The method adheres to all the rules of Java's scoping (while also considering the imports) for name resolution.
name
- the name of the classpath
- the tree path to the local scopepublic com.sun.tools.javac.code.Symbol.ClassSymbol findClassInPackage(java.lang.String name, com.sun.tools.javac.code.Symbol.PackageSymbol pck, com.sun.source.util.TreePath path)
name
in a given package.name
- the name of the classpck
- the PackageSymbol for the packagepath
- the tree path to the local scopeClassSymbol
for the class if it is found, null
otherwisepublic javax.lang.model.element.Element findMethod(java.lang.String methodName, javax.lang.model.type.TypeMirror receiverType, com.sun.source.util.TreePath path, java.util.List<javax.lang.model.type.TypeMirror> argumentTypes)
The method adheres to all the rules of Java's scoping (while also considering the imports) for name resolution.
methodName
- name of the method to findreceiverType
- type of the receiver of the methodpath
- tree pathprotected java.lang.Object buildMethodContext() throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchFieldException
Resolve$MethodResolutionContext
.java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchFieldException