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-purposeClassVisitorImplsuitable only for use by theServiceLocatorTestRuleclass to determine efficiently whether a givenClassis annotated withServiceor not.- Since:
- 2.4.0-b33
- See Also:
ServiceLocatorTestRule,ClassVisitorImpl
-
-
Constructor Summary
Constructors Modifier Constructor Description privateVisitor(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 voidvisit(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.AnnotationVisitorvisitAnnotation(java.lang.String annotationClassDescriptor, boolean visible)If the suppliedannotationClassDescriptoris equal to "Lorg/jvnet/hk2/annotations/Service;", and if the suppliedvisibleparameter istrue, attempts to load theClassencountered in the prior (guaranteed) call to thevisit(int, int, String, String, String, String[])method, and, if that is successful, adds the resultingClassto the {@linkplain ServiceLocatorTestRule.Visitor#ServiceLocatorTestRule.Visitor(Set, boolean)SetofClasses that was supplied at construction time}.voidvisitEnd()Does nothing when invoked.
-
-
-
Field Detail
-
className
private java.lang.String className
The fully qualified class name of theClassbeing 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
ASetofClasses 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- ASetofClasses 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:
visitin classClassVisitorImpl- Parameters:
version- ignoredaccess- ignoredname- the name of the class, whose package segments are separated with slashes ("/"); may benullsignature- ignoredsuperName- ignoredinterfaces- ignored- See Also:
visitAnnotation(String, boolean)
-
visitAnnotation
public final org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String annotationClassDescriptor, boolean visible)If the suppliedannotationClassDescriptoris equal to "Lorg/jvnet/hk2/annotations/Service;", and if the suppliedvisibleparameter istrue, attempts to load theClassencountered in the prior (guaranteed) call to thevisit(int, int, String, String, String, String[])method, and, if that is successful, adds the resultingClassto the {@linkplain ServiceLocatorTestRule.Visitor#ServiceLocatorTestRule.Visitor(Set, boolean)SetofClasses that was supplied at construction time}.- Overrides:
visitAnnotationin classClassVisitorImpl- Parameters:
annotationClassDescriptor- the descriptor for the annotation being visited; may benullvisible- whether the annotation is visible or not- Returns:
nullwhen invoked
-
visitEnd
public final void visitEnd()
Does nothing when invoked.- Overrides:
visitEndin classClassVisitorImpl
-
-