public class DefaultReflectionResolver extends java.lang.Object implements ReflectionResolver
ReflectionResolver
, which resolves calls
to:
Method.invoke(Object, Object...)
Constructor.newInstance(Object...)
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MSG_PREFEX_REFLECTION |
INIT
Constructor and Description |
---|
DefaultReflectionResolver(AnnotationProvider provider,
boolean debug,
javax.annotation.processing.ProcessingEnvironment processingEnv) |
Modifier and Type | Method and Description |
---|---|
Pair<AnnotatedTypeMirror.AnnotatedExecutableType,java.util.List<AnnotatedTypeMirror>> |
resolveReflectiveCall(AnnotatedTypeFactory factory,
com.sun.source.tree.MethodInvocationTree tree,
Pair<AnnotatedTypeMirror.AnnotatedExecutableType,java.util.List<AnnotatedTypeMirror>> origResult)
Resolve reflection and return the result of
factory.methodFromUse for the actual, resolved method or
constructor call. |
boolean |
shouldResolveReflection(com.sun.source.tree.MethodInvocationTree tree)
Determines whether reflection resolution has been enabled and whether the
given tree represents a reflective method or constructor call and
therefore should be resolved.
|
public static final java.lang.String MSG_PREFEX_REFLECTION
public DefaultReflectionResolver(AnnotationProvider provider, boolean debug, javax.annotation.processing.ProcessingEnvironment processingEnv)
provider
- The AnnotationProvider that provides the MethodVal annotationsdebug
- Flag to enable debugging of the reflection resolution processprocessingEnv
- The current processing environmentpublic boolean shouldResolveReflection(com.sun.source.tree.MethodInvocationTree tree)
ReflectionResolver
shouldResolveReflection
in interface ReflectionResolver
true
iff reflection should be resolved,
false
otherwisepublic Pair<AnnotatedTypeMirror.AnnotatedExecutableType,java.util.List<AnnotatedTypeMirror>> resolveReflectiveCall(AnnotatedTypeFactory factory, com.sun.source.tree.MethodInvocationTree tree, Pair<AnnotatedTypeMirror.AnnotatedExecutableType,java.util.List<AnnotatedTypeMirror>> origResult)
ReflectionResolver
factory.methodFromUse
for the actual, resolved method or
constructor call. If the reflective method cannot be resolved the
original result (origResult
) is returned.resolveReflectiveCall
in interface ReflectionResolver
factory
- the currently used AnnotatedTypeFactorytree
- the reflective invocation tree (m.invoke or c.newInstance)origResult
- the original result for the unresolved, reflective method call