/** * Attempts to discover classes that pass the test. Accumulated * classes can be accessed by calling {@link #getClasses()}. * * @param test the test to determine matching classes * @param packageNames one or more package names to scan (including subpackages) for classes */ public void find(Test test, String... packageNames) { if (packageNames == null) return; for (String pkg : packageNames) { findInPackage(test, pkg); } }
public void findNamedResource(String name, String... pathNames) { if (pathNames == null) return; Test test = new NameIs(name); for (String pkg : pathNames) { findInPackage(test, pkg); } }
/** * Attempts to discover classes that are annotated with to the annotation. Accumulated * classes can be accessed by calling {@link #getClasses()}. * * @param annotation the annotation that should be present on matching classes * @param packageNames one or more package names to scan (including subpackages) for classes */ public void findAnnotated(Class<? extends Annotation> annotation, String... packageNames) { if (packageNames == null) return; Test test = new AnnotatedWith(annotation); for (String pkg : packageNames) { findInPackage(test, pkg); } }
/** * Attempts to discover classes who's name ends with the provided suffix. Accumulated classes can be * accessed by calling {@link #getClasses()}. * * @param suffix The class name suffix to match * @param packageNames one or more package names to scan (including subpackages) for classes */ public void findSuffix(String suffix, String... packageNames) { if (packageNames == null) return; Test test = new NameEndsWith(suffix); for (String pkg : packageNames) { findInPackage(test, pkg); } }
/** * Attempts to discover classes that are assignable to the type provided. In the case * that an interface is provided this method will collect implementations. In the case * of a non-interface class, subclasses will be collected. Accumulated classes can be * accessed by calling {@link #getClasses()}. * * @param parent the class of interface to find subclasses or implementations of * @param packageNames one or more package names to scan (including subpackages) for classes */ public void findImplementations(Class parent, String... packageNames) { if (packageNames == null) return; Test test = new IsA(parent); for (String pkg : packageNames) { findInPackage(test, pkg); } }