Class ClassInfo

    • Method Detail

      • getClassName

        public String getClassName()
        Get the name of this class.
        Returns:
        The class name.
      • getClassRef

        public Class<?> getClassRef()
        Get a class reference for this class. Causes the ClassLoader to load the class.
        Returns:
        The class reference.
        Throws:
        IllegalArgumentException - if there were problems loading or initializing the class. (Note that class initialization on load is disabled by default, you can enable it with FastClasspathScanner#initializeLoadedClasses(true) .)
      • getClassRef

        public <T> Class<T> getClassRef​(Class<T> classType)
        Get a class reference for this class, casting it to the requested interface or superclass type. Causes the ClassLoader to load the class.
        Parameters:
        classType - The class to cast the result to.
        Returns:
        The class reference.
        Throws:
        IllegalArgumentException - if there were problems loading the class, initializing the class, or casting it to the requested type. (Note that class initialization on load is disabled by default, you can enable it with FastClasspathScanner#initializeLoadedClasses(true) .)
      • isExternalClass

        public boolean isExternalClass()
        Returns true if this class is an external class, i.e. was referenced by a whitelisted class as a superclass / implemented interface / annotation, but is not itself a whitelisted class.
      • getClassModifiers

        public int getClassModifiers()
        Get the class modifier flags, e.g. Modifier.PUBLIC
        Returns:
        The class modifiers.
      • getModifiersStr

        public String getModifiersStr()
        Get the field modifiers as a String, e.g. "public static final". For the modifier bits, call getModifiers().
        Returns:
        The class modifiers, in String format.
      • isPublic

        public boolean isPublic()
        Test whether this ClassInfo corresponds to a public class.
        Returns:
        true if this ClassInfo corresponds to a public class.
      • isAbstract

        public boolean isAbstract()
        Test whether this ClassInfo corresponds to an abstract class.
        Returns:
        true if this ClassInfo corresponds to an abstract class.
      • isSynthetic

        public boolean isSynthetic()
        Test whether this ClassInfo corresponds to a synthetic class.
        Returns:
        true if this ClassInfo corresponds to a synthetic class.
      • isFinal

        public boolean isFinal()
        Test whether this ClassInfo corresponds to a final class.
        Returns:
        true if this ClassInfo corresponds to a final class.
      • isAnnotation

        public boolean isAnnotation()
        Test whether this ClassInfo corresponds to an annotation.
        Returns:
        true if this ClassInfo corresponds to an annotation.
      • isInterface

        public boolean isInterface()
        Test whether this ClassInfo corresponds to an interface.
        Returns:
        true if this ClassInfo corresponds to an interface.
      • isEnum

        public boolean isEnum()
        Test whether this ClassInfo corresponds to an enum.
        Returns:
        true if this ClassInfo corresponds to an enum.
      • getTypeSignatureStr

        public String getTypeSignatureStr()
        Get the low-level Java type signature for the class, including generic type parameters, if available (else returns null).
        Returns:
        The type signature, in string format
      • getTypeSignature

        public ClassTypeSignature getTypeSignature()
        Get the type signature for the class, if available (else returns null).
        Returns:
        The class type signature.
      • getClasspathElementURLs

        @Deprecated
        public Set<URL> getClasspathElementURLs()
        Deprecated.
        The classpath element URL (classpath root dir or jar) that this class was found within. This will consist of exactly one entry, so you should call the getClasspathElementURL() method instead.
        Returns:
        The classpath element URL, stored in a set.
      • getClasspathElementURL

        public URL getClasspathElementURL()
        The classpath element URL (for a classpath root dir, jar or module) that this class was found within. N.B. Classpath elements are handled as File objects internally. It is much faster to call getClasspathElementFile() and/or getClasspathElementModule() -- the conversion of a File into a URL (via File#toURI()#toURL()) is time consuming.
        Returns:
        The classpath element, as a URL.
      • getClasspathElementFile

        public File getClasspathElementFile()
        The classpath element file (classpath root dir or jar) that this class was found within, or null if this class was found in a module.
        Returns:
        The classpath element, as a File.
      • getClasspathElementModuleRef

        public ModuleRef getClasspathElementModuleRef()
        The classpath element module that this class was found within, or null if this class was found in a directory or jar.
        Returns:
        The classpath element, as a ModuleRef.
      • getClassLoaders

        @Deprecated
        public ClassLoader[] getClassLoaders()
        Deprecated.
        Get the ClassLoader(s) to use when trying to load the class. Typically there will only be one. If there is more than one, they will be listed in the order they should be called, until one is able to load the class.

        This is deprecated, because a different ClassLoader may need to be created dynamically if classloading fails for the class (specifically to handle the case of needing to load classes from a Spring-Boot jar or similar, when running outside that jar's own classloader -- see bug #209). If you need the classloader that loaded the class, call getClassRef() and then get the classloader from that class ref.

        Returns:
        The Classloader(s) to use when trying to load the class.
      • equals

        public boolean equals​(Object obj)
        Use class name for equals().
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Use hash code of class name.
        Overrides:
        hashCode in class Object
      • getClassNames

        public static List<String> getClassNames​(Collection<ClassInfo> classInfoColl)
        Get the sorted list of the names of classes given a collection of ClassInfo objects. (Class names are not deduplicated.)
        Parameters:
        classInfoColl - The collection of ClassInfo objects.
        Returns:
        The names of classes in the collection.
      • getClassNamesReferencedInAnyTypeDescriptor

        public Set<String> getClassNamesReferencedInAnyTypeDescriptor()
        Get the names of any classes (other than this class itself) referenced in this class' type descriptor, or the type descriptors of fields or methods (if field or method info is recorded).
        Returns:
        The names of the referenced classes.
      • getClassNamesReferencedInMethodTypeDescriptors

        public Set<String> getClassNamesReferencedInMethodTypeDescriptors()
        Get the names of any classes referenced in the type descriptors of this class' methods (if method info is recorded).
        Returns:
        The names of the referenced classes.
      • getClassNamesReferencedInFieldTypeDescriptors

        public Set<String> getClassNamesReferencedInFieldTypeDescriptors()
        Get the names of any classes referenced in the type descriptors of this class' fields (if field info is recorded).
        Returns:
        The names of the referenced classes.
      • getClassNamesReferencedInClassTypeDescriptor

        public Set<String> getClassNamesReferencedInClassTypeDescriptor()
        Get the names of any classes (other than this class itself) referenced in the type descriptor of this class.
        Returns:
        The names of the referenced classes.
      • isStandardClass

        public boolean isStandardClass()
        Test whether this class is a standard class (not an annotation or interface).
        Returns:
        true if this class is a standard class (not an annotation or interface).
      • getSubclasses

        public Set<ClassInfo> getSubclasses()
        Get the subclasses of this class.
        Returns:
        the set of subclasses of this class, or the empty set if none.
      • getNamesOfSubclasses

        public List<String> getNamesOfSubclasses()
        Get the names of subclasses of this class.
        Returns:
        the sorted list of names of the subclasses of this class, or the empty list if none.
      • hasSubclass

        public boolean hasSubclass​(String subclassName)
        Test whether this class has the named class as a subclass.
        Parameters:
        subclassName - The name of the subclass.
        Returns:
        true if this class has the named class as a subclass.
      • getDirectSubclasses

        public Set<ClassInfo> getDirectSubclasses()
        Get the direct subclasses of this class.
        Returns:
        the set of direct subclasses of this class, or the empty set if none.
      • getNamesOfDirectSubclasses

        public List<String> getNamesOfDirectSubclasses()
        Get the names of direct subclasses of this class.
        Returns:
        the sorted list of names of direct subclasses of this class, or the empty list if none.
      • hasDirectSubclass

        public boolean hasDirectSubclass​(String directSubclassName)
        Test whether this class has the named direct subclass.
        Parameters:
        directSubclassName - The name of the direct subclass.
        Returns:
        true if this class has the named direct subclass.
      • getSuperclasses

        public Set<ClassInfo> getSuperclasses()
        Get all direct and indirect superclasses of this class (i.e. the direct superclass(es) of this class, and their superclass(es), all the way up to the top of the class hierarchy).

        (Includes the union of all mixin superclass hierarchies in the case of Scala mixins.)

        Returns:
        the set of all superclasses of this class, or the empty set if none.
      • getNamesOfSuperclasses

        public List<String> getNamesOfSuperclasses()
        Get the names of all direct and indirect superclasses of this class (i.e. the direct superclass(es) of this class, and their superclass(es), all the way up to the top of the class hierarchy).

        (Includes the union of all mixin superclass hierarchies in the case of Scala mixins.)

        Returns:
        the sorted list of names of all superclasses of this class, or the empty list if none.
      • hasSuperclass

        public boolean hasSuperclass​(String superclassName)
        Test whether this class extends the named superclass, directly or indirectly.
        Parameters:
        superclassName - The name of the superclass.
        Returns:
        true if this class has the named direct or indirect superclass.
      • isInnerClass

        public boolean isInnerClass()
        Returns true if this is an inner class (call isAnonymousInnerClass() to test if this is an anonymous inner class). If true, the containing class can be determined by calling getOuterClasses() or getOuterClassNames().
        Returns:
        True if this class is an inner class.
      • getOuterClasses

        public Set<ClassInfo> getOuterClasses()
        Returns the containing outer classes, for inner classes. Note that all containing outer classes are returned, not just the innermost containing outer class. Returns the empty set if this is not an inner class.
        Returns:
        The set of containing outer classes.
      • getOuterClassName

        public List<String> getOuterClassName()
        Returns the names of the containing outer classes, for inner classes. Note that all containing outer classes are returned, not just the innermost containing outer class. Returns the empty list if this is not an inner class.
        Returns:
        The name of containing outer classes.
      • isOuterClass

        public boolean isOuterClass()
        Returns true if this class contains inner classes. If true, the inner classes can be determined by calling getInnerClasses() or getInnerClassNames().
        Returns:
        True if this is an outer class.
      • getInnerClasses

        public Set<ClassInfo> getInnerClasses()
        Returns the inner classes contained within this class. Returns the empty set if none.
        Returns:
        The set of inner classes within this class.
      • getInnerClassNames

        public List<String> getInnerClassNames()
        Returns the names of inner classes contained within this class. Returns the empty list if none.
        Returns:
        The names of inner classes within this class.
      • isAnonymousInnerClass

        public boolean isAnonymousInnerClass()
        Returns true if this is an anonymous inner class. If true, the name of the containing method can be obtained by calling getFullyQualifiedContainingMethodName().
        Returns:
        True if this is an anonymous inner class.
      • getFullyQualifiedContainingMethodName

        public String getFullyQualifiedContainingMethodName()
        Get fully-qualified containing method name (i.e. fully qualified classname, followed by dot, followed by method name, for the containing method that creates an anonymous inner class.
        Returns:
        The fully-qualified method name of the method that this anonymous inner class was defined within.
      • getDirectSuperclasses

        public Set<ClassInfo> getDirectSuperclasses()
        Get the direct superclasses of this class.

        Typically the returned set will contain zero or one direct superclass(es), but may contain more than one direct superclass in the case of Scala mixins.

        Returns:
        the direct superclasses of this class, or the empty set if none.
      • getDirectSuperclass

        public ClassInfo getDirectSuperclass()
        Convenience method for getting the single direct superclass of this class. Returns null if the class does not have a superclass (e.g. in the case of interfaces). Throws IllegalArgumentException if there are multiple direct superclasses (e.g. in the case of Scala mixins) -- use getDirectSuperclasses() if you need to deal with mixins.
        Returns:
        the direct superclass of this class, or null if the class does not have a superclass.
        Throws:
        IllegalArgumentException - if there are multiple direct superclasses of this class (in the case of Scala mixins).
      • getNamesOfDirectSuperclasses

        public List<String> getNamesOfDirectSuperclasses()
        Get the names of direct superclasses of this class.

        Typically the returned list will contain zero or one direct superclass name(s), but may contain more than one direct superclass name in the case of Scala mixins.

        Returns:
        the direct superclasses of this class, or the empty set if none.
      • getNameOfDirectSuperclass

        public String getNameOfDirectSuperclass()
        Convenience method for getting the name of the single direct superclass of this class. Returns null if the class does not have a superclass (e.g. in the case of interfaces). Throws IllegalArgumentException if there are multiple direct superclasses (e.g. in the case of Scala mixins) -- use getNamesOfDirectSuperclasses() if you need to deal with mixins.
        Returns:
        the name of the direct superclass of this class, or null if the class does not have a superclass.
        Throws:
        IllegalArgumentException - if there are multiple direct superclasses of this class (in the case of Scala mixins).
      • hasDirectSuperclass

        public boolean hasDirectSuperclass​(String directSuperclassName)
        Test whether this class directly extends the named superclass.

        If this class has multiple direct superclasses (in the case of Scala mixins), returns true if the named superclass is one of the direct superclasses of this class.

        Parameters:
        directSuperclassName - The direct superclass name to match. If null, matches classes without a direct superclass (e.g. interfaces). Note that standard classes that do not extend another class have java.lang.Object as their superclass.
        Returns:
        true if this class has the named class as its direct superclass (or as one of its direct superclasses, in the case of Scala mixins).
      • isImplementedInterface

        public boolean isImplementedInterface()
        Test whether this class is an "implemented interface" (meaning a standard, non-annotation interface, or an annotation that has also been implemented as an interface by some class).

        Annotations are interfaces, but you can also implement an annotation, so to we Test whether an interface (even an annotation) is implemented by a class or extended by a subinterface, or (failing that) if it is not an interface but not an annotation.

        (This is named "implemented interface" rather than just "interface" to distinguish it from an annotation.)

        Returns:
        true if this class is an "implemented interface".
      • getSubinterfaces

        public Set<ClassInfo> getSubinterfaces()
        Get the subinterfaces of this interface.
        Returns:
        the set of subinterfaces of this interface, or the empty set if none.
      • getNamesOfSubinterfaces

        public List<String> getNamesOfSubinterfaces()
        Get the names of subinterfaces of this interface.
        Returns:
        the sorted list of names of subinterfaces of this interface, or the empty list if none.
      • hasSubinterface

        public boolean hasSubinterface​(String subinterfaceName)
        Test whether this class is has the named subinterface.
        Parameters:
        subinterfaceName - The name of the subinterface.
        Returns:
        true if this class is an interface and has the named subinterface.
      • getDirectSubinterfaces

        public Set<ClassInfo> getDirectSubinterfaces()
        Get the direct subinterfaces of this interface.
        Returns:
        the set of direct subinterfaces of this interface, or the empty set if none.
      • getNamesOfDirectSubinterfaces

        public List<String> getNamesOfDirectSubinterfaces()
        Get the names of direct subinterfaces of this interface.
        Returns:
        the sorted list of names of direct subinterfaces of this interface, or the empty list if none.
      • hasDirectSubinterface

        public boolean hasDirectSubinterface​(String directSubinterfaceName)
        Test whether this class is and interface and has the named direct subinterface.
        Parameters:
        directSubinterfaceName - The name of the direct subinterface.
        Returns:
        true if this class is and interface and has the named direct subinterface.
      • getSuperinterfaces

        public Set<ClassInfo> getSuperinterfaces()
        Get the superinterfaces of this interface.
        Returns:
        the set of superinterfaces of this interface, or the empty set if none.
      • getNamesOfSuperinterfaces

        public List<String> getNamesOfSuperinterfaces()
        Get the names of superinterfaces of this interface.
        Returns:
        the sorted list of names of superinterfaces of this interface, or the empty list if none.
      • hasSuperinterface

        public boolean hasSuperinterface​(String superinterfaceName)
        Test whether this class is an interface and has the named superinterface.
        Parameters:
        superinterfaceName - The name of the superinterface.
        Returns:
        true if this class is an interface and has the named superinterface.
      • getDirectSuperinterfaces

        public Set<ClassInfo> getDirectSuperinterfaces()
        Get the direct superinterfaces of this interface.
        Returns:
        the set of direct superinterfaces of this interface, or the empty set if none.
      • getNamesOfDirectSuperinterfaces

        public List<String> getNamesOfDirectSuperinterfaces()
        Get the names of direct superinterfaces of this interface.
        Returns:
        the sorted list of names of direct superinterfaces of this interface, or the empty list if none.
      • hasDirectSuperinterface

        public boolean hasDirectSuperinterface​(String directSuperinterfaceName)
        Test whether this class is an interface and has the named direct superinterface.
        Parameters:
        directSuperinterfaceName - The name of the direct superinterface.
        Returns:
        true if this class is an interface and has the named direct superinterface.
      • getImplementedInterfaces

        public Set<ClassInfo> getImplementedInterfaces()
        Get the interfaces implemented by this standard class, or by one of its superclasses.
        Returns:
        the set of interfaces implemented by this standard class, or by one of its superclasses. Returns the empty set if none.
      • getNamesOfImplementedInterfaces

        public List<String> getNamesOfImplementedInterfaces()
        Get the interfaces implemented by this standard class, or by one of its superclasses.
        Returns:
        the set of interfaces implemented by this standard class, or by one of its superclasses. Returns the empty list if none.
      • implementsInterface

        public boolean implementsInterface​(String interfaceName)
        Test whether this standard class implements the named interface, or by one of its superclasses.
        Parameters:
        interfaceName - The name of the interface.
        Returns:
        true this class is a standard class, and it (or one of its superclasses) implements the named interface.
      • getDirectlyImplementedInterfaces

        public Set<ClassInfo> getDirectlyImplementedInterfaces()
        Get the interfaces directly implemented by this standard class.
        Returns:
        the set of interfaces directly implemented by this standard class. Returns the empty set if none.
      • getNamesOfDirectlyImplementedInterfaces

        public List<String> getNamesOfDirectlyImplementedInterfaces()
        Get the interfaces directly implemented by this standard class, or by one of its superclasses.
        Returns:
        the set of interfaces directly implemented by this standard class, or by one of its superclasses. Returns the empty list if none.
      • directlyImplementsInterface

        public boolean directlyImplementsInterface​(String interfaceName)
        Test whether this standard class directly implements the named interface, or by one of its superclasses.
        Parameters:
        interfaceName - The name of the interface.
        Returns:
        true this class is a standard class, and directly implements the named interface.
      • getClassesImplementing

        public Set<ClassInfo> getClassesImplementing()
        Get the classes that implement this interface, and their subclasses.
        Returns:
        the set of classes implementing this interface, or the empty set if none.
      • getNamesOfClassesImplementing

        public List<String> getNamesOfClassesImplementing()
        Get the names of classes that implement this interface, and the names of their subclasses.
        Returns:
        the sorted list of names of classes implementing this interface, or the empty list if none.
      • isImplementedByClass

        public boolean isImplementedByClass​(String className)
        Test whether this class is implemented by the named class, or by one of its superclasses.
        Parameters:
        className - The name of the class.
        Returns:
        true if this class is implemented by the named class, or by one of its superclasses.
      • getClassesDirectlyImplementing

        public Set<ClassInfo> getClassesDirectlyImplementing()
        Get the classes that directly implement this interface, and their subclasses.
        Returns:
        the set of classes directly implementing this interface, or the empty set if none.
      • getNamesOfClassesDirectlyImplementing

        public List<String> getNamesOfClassesDirectlyImplementing()
        Get the names of classes that directly implement this interface, and the names of their subclasses.
        Returns:
        the sorted list of names of classes directly implementing this interface, or the empty list if none.
      • isDirectlyImplementedByClass

        public boolean isDirectlyImplementedByClass​(String className)
        Test whether this class is directly implemented by the named class, or by one of its superclasses.
        Parameters:
        className - The name of the class.
        Returns:
        true if this class is directly implemented by the named class, or by one of its superclasses.
      • getClassesWithAnnotation

        public Set<ClassInfo> getClassesWithAnnotation()
        Get the standard classes and non-annotation interfaces that are annotated by this annotation.
        Returns:
        the set of standard classes and non-annotation interfaces that are annotated by the annotation corresponding to this ClassInfo class, or the empty set if none.
      • getNamesOfClassesWithAnnotation

        public List<String> getNamesOfClassesWithAnnotation()
        Get the names of standard classes and non-annotation interfaces that are annotated by this annotation. .
        Returns:
        the sorted list of names of ClassInfo objects for standard classes and non-annotation interfaces that are annotated by the annotation corresponding to this ClassInfo class, or the empty list if none.
      • annotatesClass

        public boolean annotatesClass​(String annotatedClassName)
        Test whether this class annotates the named class.
        Parameters:
        annotatedClassName - The name of the annotated class.
        Returns:
        True if this class annotates the named class.
      • getClassesWithDirectAnnotation

        public Set<ClassInfo> getClassesWithDirectAnnotation()
        Get the standard classes or non-annotation interfaces that are directly annotated with this annotation.
        Returns:
        the set of standard classes or non-annotation interfaces that are directly annotated with this annotation, or the empty set if none.
      • getNamesOfClassesWithDirectAnnotation

        public List<String> getNamesOfClassesWithDirectAnnotation()
        Get the names of standard classes or non-annotation interfaces that are directly annotated with this annotation.
        Returns:
        the sorted list of names of standard classes or non-annotation interfaces that are directly annotated with this annotation, or the empty list if none.
      • directlyAnnotatesClass

        public boolean directlyAnnotatesClass​(String directlyAnnotatedClassName)
        Test whether this class directly annotates the named class.
        Parameters:
        directlyAnnotatedClassName - The name of the directly annotated class.
        Returns:
        true if this class directly annotates the named class.
      • getAnnotations

        public Set<ClassInfo> getAnnotations()
        Get the annotations and meta-annotations on this class. This is equivalent to the reflection call Class#getAnnotations(), except that it does not require calling the classloader, and it returns meta-annotations as well as annotations.
        Returns:
        the set of annotations and meta-annotations on this class or interface, or meta-annotations if this is an annotation. Returns the empty set if none.
      • getNamesOfAnnotations

        public List<String> getNamesOfAnnotations()
        Get the names of annotations and meta-annotations on this class. This is equivalent to the reflection call Class#getAnnotations(), except that it does not require calling the classloader, and it returns meta-annotations as well as annotations.
        Returns:
        the sorted list of names of annotations and meta-annotations on this class or interface, or meta-annotations if this is an annotation. Returns the empty list if none.
      • hasAnnotation

        public boolean hasAnnotation​(String annotationName)
        Test whether this class, interface or annotation has the named class annotation or meta-annotation.
        Parameters:
        annotationName - The name of the annotation.
        Returns:
        true if this class, interface or annotation has the named class annotation or meta-annotation.
      • getAnnotationInfo

        public List<AnnotationInfo> getAnnotationInfo()
        Get a list of annotations on this method, along with any annotation parameter values, wrapped in AnnotationInfo objects, or the empty list if none.
        Returns:
        A list of AnnotationInfo objects for the annotations on this method, or the empty list if none.
      • getAnnotationDefaultParamValues

        public List<AnnotationInfo.AnnotationParamValue> getAnnotationDefaultParamValues()
        Get a list of the default parameter values, if this is an annotation, and it has default parameter values. Otherwise returns the empty list.
        Returns:
        If this is an annotation class, the list of AnnotationInfo.AnnotationParamValue objects for each of the default parameter values for this annotation, otherwise the empty list.
      • getDirectAnnotations

        public Set<ClassInfo> getDirectAnnotations()
        Get the direct annotations and meta-annotations on this class. This is equivalent to the reflection call Class#getAnnotations(), except that it does not require calling the classloader, and it returns meta-annotations as well as annotations.
        Returns:
        the set of direct annotations and meta-annotations on this class, or the empty set if none.
      • getNamesOfDirectAnnotations

        public List<String> getNamesOfDirectAnnotations()
        Get the names of direct annotations and meta-annotations on this class. This is equivalent to the reflection call Class#getAnnotations(), except that it does not require calling the classloader, and it returns meta-annotations as well as annotations.
        Returns:
        the sorted list of names of direct annotations and meta-annotations on this class, or the empty list if none.
      • hasDirectAnnotation

        public boolean hasDirectAnnotation​(String directAnnotationName)
        Test whether this class has the named direct annotation or meta-annotation. (This is equivalent to the reflection call Class#hasAnnotation(), except that it does not require calling the classloader, and it works for meta-annotations as well as Annotatinons.)
        Parameters:
        directAnnotationName - The name of the direct annotation.
        Returns:
        true if this class has the named direct annotation or meta-annotation.
      • getMetaAnnotations

        public Set<ClassInfo> getMetaAnnotations()
        Get the annotations and meta-annotations on this annotation class.
        Returns:
        the set of annotations and meta-annotations, if this is an annotation class, or the empty set if none (or if this is not an annotation class).
      • getNamesOfMetaAnnotations

        public List<String> getNamesOfMetaAnnotations()
        Get the names of annotations and meta-annotations on this annotation class.
        Returns:
        the set of annotations and meta-annotations, if this is an annotation class, or the empty list if none (or if this is not an annotation class).
      • hasMetaAnnotation

        public boolean hasMetaAnnotation​(String metaAnnotationName)
        Test whether this is an annotation class and it has the named meta-annotation.
        Parameters:
        metaAnnotationName - The meta-annotation name.
        Returns:
        true if this is an annotation class and it has the named meta-annotation.
      • getAnnotationsWithMetaAnnotation

        public Set<ClassInfo> getAnnotationsWithMetaAnnotation()
        Get the annotations that have this meta-annotation.
        Returns:
        the set of annotations that have this meta-annotation, or the empty set if none.
      • getNamesOfAnnotationsWithMetaAnnotation

        public List<String> getNamesOfAnnotationsWithMetaAnnotation()
        Get the names of annotations that have this meta-annotation.
        Returns:
        the sorted list of names of annotations that have this meta-annotation, or the empty list if none.
      • metaAnnotatesAnnotation

        public boolean metaAnnotatesAnnotation​(String annotationName)
        Test whether this annotation has the named meta-annotation.
        Parameters:
        annotationName - The annotation name.
        Returns:
        true if this annotation has the named meta-annotation.
      • getAnnotationsWithDirectMetaAnnotation

        public Set<ClassInfo> getAnnotationsWithDirectMetaAnnotation()
        Get the annotations that have this direct meta-annotation.
        Returns:
        the set of annotations that have this direct meta-annotation, or the empty set if none.
      • getNamesOfAnnotationsWithDirectMetaAnnotation

        public List<String> getNamesOfAnnotationsWithDirectMetaAnnotation()
        Get the names of annotations that have this direct meta-annotation.
        Returns:
        the sorted list of names of annotations that have this direct meta-annotation, or the empty list if none.
      • hasDirectMetaAnnotation

        public boolean hasDirectMetaAnnotation​(String directMetaAnnotationName)
        Test whether this annotation is directly meta-annotated with the named annotation.
        Parameters:
        directMetaAnnotationName - The direct meta-annotation name.
        Returns:
        true if this annotation is directly meta-annotated with the named annotation.
      • getMethodInfo

        public List<MethodInfo> getMethodInfo()
        Returns information on visible methods of the class that are not constructors. There may be more than one method of a given name with different type signatures, due to overloading.

        Requires that FastClasspathScanner#enableMethodInfo() be called before scanning, otherwise throws IllegalArgumentException.

        By default only returns information for public methods, unless FastClasspathScanner#ignoreMethodVisibility() was called before the scan. If method visibility is ignored, the result may include a reference to a private static class initializer block, with a method name of "<clinit>".

        Returns:
        the list of MethodInfo objects for visible methods of this class, or the empty list if no methods were found or visible.
        Throws:
        IllegalArgumentException - if FastClasspathScanner#enableMethodInfo() was not called prior to initiating the scan.
      • getConstructorInfo

        public List<MethodInfo> getConstructorInfo()
        Returns information on visible constructors of the class. Constructors have the method name of "<init>". There may be more than one constructor of a given name with different type signatures, due to overloading.

        Requires that FastClasspathScanner#enableMethodInfo() be called before scanning, otherwise throws IllegalArgumentException.

        By default only returns information for public constructors, unless FastClasspathScanner#ignoreMethodVisibility() was called before the scan.

        Returns:
        the list of MethodInfo objects for visible constructors of this class, or the empty list if no constructors were found or visible.
        Throws:
        IllegalArgumentException - if FastClasspathScanner#enableMethodInfo() was not called prior to initiating the scan.
      • getMethodAndConstructorInfo

        public List<MethodInfo> getMethodAndConstructorInfo()
        Returns information on visible methods and constructors of the class. There may be more than one method or constructor or method of a given name with different type signatures, due to overloading. Constructors have the method name of "<init>".

        Requires that FastClasspathScanner#enableMethodInfo() be called before scanning, otherwise throws IllegalArgumentException.

        By default only returns information for public methods and constructors, unless FastClasspathScanner#ignoreMethodVisibility() was called before the scan. If method visibility is ignored, the result may include a reference to a private static class initializer block, with a method name of "<clinit>".

        Returns:
        the list of MethodInfo objects for visible methods and constructors of this class, or the empty list if no methods or constructors were found or visible.
        Throws:
        IllegalArgumentException - if FastClasspathScanner#enableMethodInfo() was not called prior to initiating the scan.
      • getMethodInfo

        public List<MethodInfo> getMethodInfo​(String methodName)
        Returns information on the method(s) of the class with the given method name. Constructors have the method name of "<init>".

        Requires that FastClasspathScanner#enableMethodInfo() be called before scanning, otherwise throws IllegalArgumentException.

        By default only returns information for public methods, unless FastClasspathScanner#ignoreMethodVisibility() was called before the scan.

        May return info for multiple methods with the same name (with different type signatures).

        Parameters:
        methodName - The method name to query.
        Returns:
        a list of MethodInfo objects for the method(s) with the given name, or the empty list if the method was not found in this class (or is not visible).
        Throws:
        IllegalArgumentException - if FastClasspathScanner#enableMethodInfo() was not called prior to initiating the scan.
      • getMethodDirectAnnotations

        public Set<ClassInfo> getMethodDirectAnnotations()
        Get the direct method direct annotations on this class.
        Returns:
        the set of method direct annotations on this class, or the empty set if none.
      • getMethodAnnotations

        public Set<ClassInfo> getMethodAnnotations()
        Get the method annotations or meta-annotations on this class.
        Returns:
        the set of method annotations or meta-annotations on this class, or the empty set if none.
      • getNamesOfMethodDirectAnnotations

        public List<String> getNamesOfMethodDirectAnnotations()
        Get the names of method direct annotations on this class.
        Returns:
        the sorted list of names of method direct annotations on this class, or the empty list if none.
      • getNamesOfMethodAnnotations

        public List<String> getNamesOfMethodAnnotations()
        Get the names of method annotations or meta-annotations on this class.
        Returns:
        the sorted list of names of method annotations or meta-annotations on this class, or the empty list if none.
      • hasMethodWithDirectAnnotation

        public boolean hasMethodWithDirectAnnotation​(String annotationName)
        Test whether this class has a method with the named method direct annotation.
        Parameters:
        annotationName - The annotation name.
        Returns:
        true if this class has a method with the named direct annotation.
      • hasMethodWithAnnotation

        public boolean hasMethodWithAnnotation​(String annotationName)
        Test whether this class has a method with the named method annotation or meta-annotation.
        Parameters:
        annotationName - The annotation name.
        Returns:
        true if this class has a method with the named annotation or meta-annotation.
      • getClassesWithDirectMethodAnnotation

        public Set<ClassInfo> getClassesWithDirectMethodAnnotation()
        Get the classes that have a method with this direct annotation.
        Returns:
        the set of classes that have a method with this direct annotation, or the empty set if none.
      • getClassesWithMethodAnnotation

        public Set<ClassInfo> getClassesWithMethodAnnotation()
        Get the classes that have a method with this annotation or meta-annotation.
        Returns:
        the set of classes that have a method with this annotation or meta-annotation, or the empty set if none.
      • getNamesOfClassesWithDirectMethodAnnotation

        public List<String> getNamesOfClassesWithDirectMethodAnnotation()
        Get the names of classes that have a method with this direct annotation.
        Returns:
        the sorted list of names of classes that have a method with this direct annotation, or the empty list if none.
      • getNamesOfClassesWithMethodAnnotation

        public List<String> getNamesOfClassesWithMethodAnnotation()
        Get the names of classes that have a method with this annotation.
        Returns:
        the sorted list of names of classes that have a method with this annotation, or the empty list if none.
      • annotatesMethodOfClass

        public boolean annotatesMethodOfClass​(String className)
        Test whether this annotation annotates or meta-annotates a method of the named class.
        Parameters:
        className - The class name.
        Returns:
        true if this annotation annotates a method of the named class.
      • getFieldInfo

        public List<FieldInfo> getFieldInfo()
        Returns information on all visible fields of the class.

        Requires that FastClasspathScanner#enableFieldInfo() be called before scanning, otherwise throws IllegalArgumentException.

        By default only returns information for public methods, unless FastClasspathScanner#ignoreFieldVisibility() was called before the scan.

        Returns:
        the list of FieldInfo objects for visible fields of this class, or the empty list if no fields were found or visible.
        Throws:
        IllegalArgumentException - if FastClasspathScanner#enableFieldInfo() was not called prior to initiating the scan.
      • getFieldInfo

        public FieldInfo getFieldInfo​(String fieldName)
        Returns information on a given visible field of the class.

        Requires that FastClasspathScanner#enableFieldInfo() be called before scanning, otherwise throws IllegalArgumentException.

        By default only returns information for public fields, unless FastClasspathScanner#ignoreFieldVisibility() was called before the scan.

        Parameters:
        fieldName - The field name to query.
        Returns:
        the FieldInfo object for the named field, or null if the field was not found in this class (or is not visible).
        Throws:
        IllegalArgumentException - if FastClasspathScanner#enableFieldInfo() was not called prior to initiating the scan.
      • getFieldAnnotations

        public Set<ClassInfo> getFieldAnnotations()
        Get the field annotations on this class.
        Returns:
        the set of field annotations on this class, or the empty set if none.
      • getNamesOfFieldAnnotations

        public List<String> getNamesOfFieldAnnotations()
        Get the names of field annotations on this class.
        Returns:
        the sorted list of names of field annotations on this class, or the empty list if none.
      • hasFieldWithAnnotation

        public boolean hasFieldWithAnnotation​(String annotationName)
        Test whether this class has a field with the named field annotation.
        Parameters:
        annotationName - The annotation name.
        Returns:
        true if this class has a field with the named annotation.
      • getClassesWithFieldAnnotation

        public Set<ClassInfo> getClassesWithFieldAnnotation()
        Get the classes that have a field with this annotation or meta-annotation.
        Returns:
        the set of classes that have a field with this annotation or meta-annotation, or the empty set if none.
      • getNamesOfClassesWithFieldAnnotation

        public List<String> getNamesOfClassesWithFieldAnnotation()
        Get the names of classes that have a field with this annotation or meta-annotation.
        Returns:
        the sorted list of names of classes that have a field with this annotation or meta-annotation, or the empty list if none.
      • getClassesWithDirectFieldAnnotation

        public Set<ClassInfo> getClassesWithDirectFieldAnnotation()
        Get the classes that have a field with this direct annotation.
        Returns:
        the set of classes that have a field with this direct annotation, or the empty set if none.
      • getNamesOfClassesWithDirectFieldAnnotation

        public List<String> getNamesOfClassesWithDirectFieldAnnotation()
        Get the names of classes that have a field with this direct annotation.
        Returns:
        the sorted list of names of classes that have a field with thisdirect annotation, or the empty list if none.
      • annotatesFieldOfClass

        public boolean annotatesFieldOfClass​(String className)
        Test whether this annotation annotates a field of the named class.
        Parameters:
        className - The class name.
        Returns:
        true if this annotation annotates a field of the named class.