Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PackageScanClassResolver |
|
| 1.0;1 |
1 | package liquibase.servicelocator; | |
2 | ||
3 | import java.lang.annotation.Annotation; | |
4 | import java.util.Set; | |
5 | ||
6 | /** | |
7 | * A resolver that can find resources based on package scanning. | |
8 | */ | |
9 | public interface PackageScanClassResolver { | |
10 | ||
11 | /** | |
12 | * Sets the ClassLoader instances that should be used when scanning for classes. If none is set then the context | |
13 | * classloader will be used. | |
14 | * | |
15 | * @param classLoaders | |
16 | * loaders to use when scanning for classes | |
17 | */ | |
18 | void setClassLoaders(Set<ClassLoader> classLoaders); | |
19 | ||
20 | /** | |
21 | * Gets the ClassLoader instances that should be used when scanning for classes. | |
22 | * | |
23 | * @return the class loaders to use | |
24 | */ | |
25 | Set<ClassLoader> getClassLoaders(); | |
26 | ||
27 | /** | |
28 | * Adds the class loader to the existing loaders | |
29 | * | |
30 | * @param classLoader | |
31 | * the loader to add | |
32 | */ | |
33 | void addClassLoader(ClassLoader classLoader); | |
34 | ||
35 | /** | |
36 | * Attempts to discover classes that are assignable to the type provided. In the case that an interface is provided | |
37 | * this method will collect implementations. In the case of a non-interface class, subclasses will be collected. | |
38 | * | |
39 | * @param parent | |
40 | * the class of interface to find subclasses or implementations of | |
41 | * @param packageNames | |
42 | * one or more package names to scan (including subpackages) for classes | |
43 | * @return the classes found, returns an empty set if none found | |
44 | */ | |
45 | Set<Class<?>> findImplementations(Class<?> parent, String... packageNames); | |
46 | ||
47 | /** | |
48 | * Attempts to discover classes filter by the provided filter | |
49 | * | |
50 | * @param filter | |
51 | * filter to filter desired classes. | |
52 | * @param packageNames | |
53 | * one or more package names to scan (including subpackages) for classes | |
54 | * @return the classes found, returns an empty set if none found | |
55 | */ | |
56 | Set<Class<?>> findByFilter(PackageScanFilter filter, String... packageNames); | |
57 | ||
58 | /** | |
59 | * Add a filter that will be applied to all scan operations | |
60 | * | |
61 | * @param filter | |
62 | * filter to filter desired classes in all scan operations | |
63 | */ | |
64 | void addFilter(PackageScanFilter filter); | |
65 | ||
66 | /** | |
67 | * Removes the filter | |
68 | * | |
69 | * @param filter | |
70 | * filter to filter desired classes in all scan operations | |
71 | */ | |
72 | void removeFilter(PackageScanFilter filter); | |
73 | } |