com.opensymphony.xwork2.util.finder

## Interface ClassFinder

-     public interface ClassFinder

  ClassFinder searches the classpath of the specified ClassLoaderInterface for packages, classes, constructors, methods, or fields with specific annotations.

  For security reasons ASM is used to find the annotations. Classes are not loaded unless they match the requirements of a called findAnnotated* method. Once loaded, these classes are cached.

  The getClassesNotLoaded() method can be used immediately after any find* method to get a list of classes which matched the find requirements (i.e. contained the annotation), but were unable to be loaded.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `ClassFinder.Annotatable`
    `static class` | `ClassFinder.AnnotationInfo`
    `static class` | `ClassFinder.ClassInfo`
    `static class` | `ClassFinder.FieldInfo`
    `static interface` | `ClassFinder.Info`
    `static class` | `ClassFinder.MethodInfo`
    `static class` | `ClassFinder.PackageInfo`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<Class<?>>` | `findAnnotatedClasses(Class<? extends Annotation> annotation)`
    `List<Constructor<?>>` | `findAnnotatedConstructors(Class<? extends Annotation> annotation)`
    `List<Field>` | `findAnnotatedFields(Class<? extends Annotation> annotation)`
    `List<Method>` | `findAnnotatedMethods(Class<? extends Annotation> annotation)`
    `List<Package>` | `findAnnotatedPackages(Class<? extends Annotation> annotation)`
    `List<Class<?>>` | `findClasses()`
    `List<Class<?>>` | `findClasses(Test<ClassFinder.ClassInfo> test)`
    `List<Class<?>>` | `findClassesInPackage(String packageName, boolean recursive)`
    `List<String>` | `getClassesNotLoaded()` Returns a list of classes that could not be loaded in last invoked findAnnotated* method.
    `ClassLoaderInterface` | `getClassLoaderInterface()`
    `boolean` | `isAnnotationPresent(Class<? extends Annotation> annotation)`

- - ### Method Detail

    - #### isAnnotationPresent

          boolean isAnnotationPresent(Class<? extends Annotation> annotation)

    - #### getClassesNotLoaded

          List<String> getClassesNotLoaded()

      Returns a list of classes that could not be loaded in last invoked findAnnotated* method.

      The list will only contain entries of classes whose byte code matched the requirements of last invoked find* method, but were unable to be loaded and included in the results.

      The list returned is unmodifiable. Once obtained, the returned list will be a live view of the results from the last findAnnotated* method call.

      This method is not thread safe.

      Returns:
        an unmodifiable live view of classes that could not be loaded in previous findAnnotated* call.

    - #### findAnnotatedPackages

          List<Package> findAnnotatedPackages(Class<? extends Annotation> annotation)

    - #### findAnnotatedClasses

          List<Class<?>> findAnnotatedClasses(Class<? extends Annotation> annotation)

    - #### findAnnotatedMethods

          List<Method> findAnnotatedMethods(Class<? extends Annotation> annotation)

    - #### findAnnotatedConstructors

          List<Constructor<?>> findAnnotatedConstructors(Class<? extends Annotation> annotation)

    - #### findAnnotatedFields

          List<Field> findAnnotatedFields(Class<? extends Annotation> annotation)

    - #### findClassesInPackage

          List<Class<?>> findClassesInPackage(String packageName,
                                              boolean recursive)

    - #### findClasses

          List<Class<?>> findClasses(Test<ClassFinder.ClassInfo> test)

    - #### findClasses

          List<Class<?>> findClasses()

    - #### getClassLoaderInterface

          ClassLoaderInterface getClassLoaderInterface()

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.