private static final class ServiceLocatorTestRule.Visitor extends ClassVisitorImpl
ClassVisitorImpl
suitable
only for use by the ServiceLocatorTestRule
class to
determine efficiently whether a given Class
is annotated
with Service
or not.ServiceLocatorTestRule
,
ClassVisitorImpl
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.Class<?>> |
classes
|
private java.lang.String |
className
The fully qualified class name of the
Class being
visited. |
Modifier | Constructor and Description |
---|---|
private |
Visitor(java.util.Set<java.lang.Class<?>> classes,
boolean verbose)
Creates a new
ServiceLocatorTestRule.Visitor . |
Modifier and Type | Method and Description |
---|---|
void |
visit(int version,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String superName,
java.lang.String[] interfaces)
Called when a class file is encountered and internally records
its fully qualified class name.
|
org.objectweb.asm.AnnotationVisitor |
visitAnnotation(java.lang.String annotationClassDescriptor,
boolean visible)
If the supplied
annotationClassDescriptor is equal to
"Lorg/jvnet/hk2/annotations/Service; ", and if the
supplied visible parameter is true , attempts to
load
the Class encountered in the prior (guaranteed) call to
the visit(int, int, String, String, String, String[])
method, and, if that is successful, adds the resulting Class to the Set of Class es that was
supplied at construction time. |
void |
visitEnd()
Does nothing when invoked.
|
private java.lang.String className
Class
being
visited.
This field may be null
.
This field is set by the visit(int, int, String, String, String, String[])
method.
private final java.util.Set<java.lang.Class<?>> classes
Set
of Class
es that will be added to by the
visitAnnotation(String, boolean)
method.
This field is never null
.
private Visitor(java.util.Set<java.lang.Class<?>> classes, boolean verbose)
ServiceLocatorTestRule.Visitor
.classes
- A Set
of Class
es that will be
added to by the visitAnnotation(String, boolean)
method; must not be null
; must be mutableverbose
- whether or not additional information should be
outputvisitAnnotation(String, boolean)
public final void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
It is guaranteed that this method will be called before the
visitAnnotation(String, boolean)
method on the current
thread.
visit
in class ClassVisitorImpl
version
- ignoredaccess
- ignoredname
- the name of the class, whose package segments are
separated with slashes ("/
"); may be null
signature
- ignoredsuperName
- ignoredinterfaces
- ignoredvisitAnnotation(String, boolean)
public final org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String annotationClassDescriptor, boolean visible)
annotationClassDescriptor
is equal to
"Lorg/jvnet/hk2/annotations/Service;
", and if the
supplied visible
parameter is true
, attempts to
load
the Class
encountered in the prior (guaranteed) call to
the visit(int, int, String, String, String, String[])
method, and, if that is successful, adds the resulting Class
to the Set
of Class
es that was
supplied at construction time.visitAnnotation
in class ClassVisitorImpl
annotationClassDescriptor
- the descriptor for the
annotation being visited; may be null
visible
- whether the annotation is visible or notnull
when invokedServiceLocatorTestRule.Visitor(Set,
boolean)
public final void visitEnd()
visitEnd
in class ClassVisitorImpl