Package org.jvnet.hk2.testing.junit
Class ServiceLocatorTestRule.Visitor
- java.lang.Object
-
- org.objectweb.asm.ClassVisitor
-
- org.jvnet.hk2.testing.junit.internal.ClassVisitorImpl
-
- org.jvnet.hk2.testing.junit.ServiceLocatorTestRule.Visitor
-
- Enclosing class:
- ServiceLocatorTestRule<T>
private static final class ServiceLocatorTestRule.Visitor extends ClassVisitorImpl
A very, very special-purposeClassVisitorImpl
suitable only for use by theServiceLocatorTestRule
class to determine efficiently whether a givenClass
is annotated withService
or not.- Since:
- 2.4.0-b33
- See Also:
ServiceLocatorTestRule
,ClassVisitorImpl
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Visitor(java.util.Set<java.lang.Class<?>> classes, boolean verbose)
Creates a newServiceLocatorTestRule.Visitor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 suppliedannotationClassDescriptor
is equal to "Lorg/jvnet/hk2/annotations/Service;
", and if the suppliedvisible
parameter istrue
, attempts to load theClass
encountered in the prior (guaranteed) call to thevisit(int, int, String, String, String, String[])
method, and, if that is successful, adds the resultingClass
to the {@linkplain ServiceLocatorTestRule.Visitor#ServiceLocatorTestRule.Visitor(Set, boolean)Set
ofClass
es that was supplied at construction time}.void
visitEnd()
Does nothing when invoked.
-
-
-
Field Detail
-
className
private java.lang.String className
The fully qualified class name of theClass
being visited.This field may be
null
.This field is set by the
visit(int, int, String, String, String, String[])
method.
-
classes
private final java.util.Set<java.lang.Class<?>> classes
ASet
ofClass
es that will be added to by thevisitAnnotation(String, boolean)
method.This field is never
null
.- See Also:
visitAnnotation(String, boolean)
-
-
Constructor Detail
-
Visitor
private Visitor(java.util.Set<java.lang.Class<?>> classes, boolean verbose)
Creates a newServiceLocatorTestRule.Visitor
.- Parameters:
classes
- ASet
ofClass
es that will be added to by thevisitAnnotation(String, boolean)
method; must not benull
; must be mutableverbose
- whether or not additional information should be output- See Also:
visitAnnotation(String, boolean)
-
-
Method Detail
-
visit
public final 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.It is guaranteed that this method will be called before the
visitAnnotation(String, boolean)
method on the current thread.- Overrides:
visit
in classClassVisitorImpl
- Parameters:
version
- ignoredaccess
- ignoredname
- the name of the class, whose package segments are separated with slashes ("/
"); may benull
signature
- ignoredsuperName
- ignoredinterfaces
- ignored- See Also:
visitAnnotation(String, boolean)
-
visitAnnotation
public final org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String annotationClassDescriptor, boolean visible)
If the suppliedannotationClassDescriptor
is equal to "Lorg/jvnet/hk2/annotations/Service;
", and if the suppliedvisible
parameter istrue
, attempts to load theClass
encountered in the prior (guaranteed) call to thevisit(int, int, String, String, String, String[])
method, and, if that is successful, adds the resultingClass
to the {@linkplain ServiceLocatorTestRule.Visitor#ServiceLocatorTestRule.Visitor(Set, boolean)Set
ofClass
es that was supplied at construction time}.- Overrides:
visitAnnotation
in classClassVisitorImpl
- Parameters:
annotationClassDescriptor
- the descriptor for the annotation being visited; may benull
visible
- whether the annotation is visible or not- Returns:
null
when invoked
-
visitEnd
public final void visitEnd()
Does nothing when invoked.- Overrides:
visitEnd
in classClassVisitorImpl
-
-