Package org.apache.cxf.common.util
Class ClasspathScanner
- java.lang.Object
-
- org.apache.cxf.common.util.ClasspathScanner
-
public class ClasspathScanner extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALL_CLASS_FILES
static String
ALL_FILES
static String
CLASSPATH_URL_SCHEME
static String
WILDCARD
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClasspathScanner()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Map<Class<? extends Annotation>,Collection<Class<?>>>
findClasses(String basePackage, Class<? extends Annotation>... annotations)
Scans list of base packages for all classes marked with specific annotations.static Map<Class<? extends Annotation>,Collection<Class<?>>>
findClasses(Collection<String> basePackages, Class<? extends Annotation>... annotations)
Scans list of base packages for all classes marked with specific annotations.static Map<Class<? extends Annotation>,Collection<Class<?>>>
findClasses(Collection<String> basePackages, List<Class<? extends Annotation>> annotations)
Scans list of base packages for all classes marked with specific annotations.static Map<Class<? extends Annotation>,Collection<Class<?>>>
findClasses(Collection<String> basePackages, List<Class<? extends Annotation>> annotations, ClassLoader loader)
protected Map<Class<? extends Annotation>,Collection<Class<?>>>
findClassesInternal(Collection<String> basePackages, List<Class<? extends Annotation>> annotations, ClassLoader loader)
static List<URL>
findResources(String basePackage, String extension)
Scans list of base packages for all resources with the given extension.static List<URL>
findResources(String basePackage, String extension, ClassLoader loader)
Scans list of base packages for all resources with the given extension.static List<URL>
findResources(Collection<String> basePackages, String extension)
Scans list of base packages for all resources with the given extension.static List<URL>
findResources(Collection<String> basePackages, String extension, ClassLoader loader)
protected List<URL>
findResourcesInternal(Collection<String> basePackages, String extension, ClassLoader loader)
static Set<String>
parsePackages(String packagesAsCsv)
-
-
-
Field Detail
-
ALL_FILES
public static final String ALL_FILES
- See Also:
- Constant Field Values
-
ALL_CLASS_FILES
public static final String ALL_CLASS_FILES
- See Also:
- Constant Field Values
-
WILDCARD
public static final String WILDCARD
- See Also:
- Constant Field Values
-
CLASSPATH_URL_SCHEME
public static final String CLASSPATH_URL_SCHEME
- See Also:
- Constant Field Values
-
-
Method Detail
-
findClasses
@SafeVarargs public static Map<Class<? extends Annotation>,Collection<Class<?>>> findClasses(String basePackage, Class<? extends Annotation>... annotations) throws IOException, ClassNotFoundException
Scans list of base packages for all classes marked with specific annotations.- Parameters:
basePackage
- base packageannotations
- annotations to discover- Returns:
- all discovered classes grouped by annotations they belong too
- Throws:
IOException
- class metadata is not readableClassNotFoundException
- class not found
-
findClasses
@SafeVarargs public static Map<Class<? extends Annotation>,Collection<Class<?>>> findClasses(Collection<String> basePackages, Class<? extends Annotation>... annotations) throws IOException, ClassNotFoundException
Scans list of base packages for all classes marked with specific annotations.- Parameters:
basePackages
- list of base packagesannotations
- annotations to discover- Returns:
- all discovered classes grouped by annotations they belong too
- Throws:
IOException
- class metadata is not readableClassNotFoundException
- class not found
-
findClasses
public static Map<Class<? extends Annotation>,Collection<Class<?>>> findClasses(Collection<String> basePackages, List<Class<? extends Annotation>> annotations) throws IOException, ClassNotFoundException
Scans list of base packages for all classes marked with specific annotations.- Parameters:
basePackages
- list of base packagesannotations
- annotations to discover- Returns:
- all discovered classes grouped by annotations they belong too
- Throws:
IOException
- class metadata is not readableClassNotFoundException
- class not found
-
findClasses
public static Map<Class<? extends Annotation>,Collection<Class<?>>> findClasses(Collection<String> basePackages, List<Class<? extends Annotation>> annotations, ClassLoader loader) throws IOException, ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
-
findClassesInternal
protected Map<Class<? extends Annotation>,Collection<Class<?>>> findClassesInternal(Collection<String> basePackages, List<Class<? extends Annotation>> annotations, ClassLoader loader) throws IOException, ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
-
findResources
public static List<URL> findResources(String basePackage, String extension) throws IOException
Scans list of base packages for all resources with the given extension.- Parameters:
basePackage
- base packageextension
- the extension matching resources needs to have- Returns:
- list of all discovered resource URLs
- Throws:
IOException
- resource is not accessible
-
findResources
public static List<URL> findResources(String basePackage, String extension, ClassLoader loader) throws IOException
Scans list of base packages for all resources with the given extension.- Parameters:
basePackage
- base packageextension
- the extension matching resources needs to have- Returns:
- list of all discovered resource URLs
- Throws:
IOException
- resource is not accessible
-
findResources
public static List<URL> findResources(Collection<String> basePackages, String extension) throws IOException
Scans list of base packages for all resources with the given extension.- Parameters:
basePackages
- list of base packagesextension
- the extension matching resources needs to have- Returns:
- list of all discovered resource URLs
- Throws:
IOException
- resource is not accessible
-
findResources
public static List<URL> findResources(Collection<String> basePackages, String extension, ClassLoader loader) throws IOException
- Throws:
IOException
-
findResourcesInternal
protected List<URL> findResourcesInternal(Collection<String> basePackages, String extension, ClassLoader loader) throws IOException
- Throws:
IOException
-
-