org.apache.camel.spi
Interface PackageScanClassResolver

All Known Implementing Classes:
DefaultPackageScanClassResolver, WebSpherePacakageScanClassResolver

public interface PackageScanClassResolver

A resolver that can find resources based on package scanning.


Method Summary
 void addClassLoader(ClassLoader classLoader)
          Adds the class loader to the existing loaders
 void addFilter(PackageScanFilter filter)
          Add a filter that will be applied to all scan operations
 Set<Class> findAnnotated(Class<? extends Annotation> annotation, String... packageNames)
          Attempts to discover classes that are annotated with to the annotation.
 Set<Class> findAnnotated(Set<Class<? extends Annotation>> annotations, String... packageNames)
          Attempts to discover classes that are annotated with to the annotation.
 Set<Class> findByFilter(PackageScanFilter fiter, String... packageNames)
          Attemsp to discover classes filter by the provided filter
 Set<Class> findImplementations(Class parent, String... packageNames)
          Attempts to discover classes that are assignable to the type provided.
 Set<ClassLoader> getClassLoaders()
          Gets the ClassLoader instances that should be used when scanning for classes.
 void setClassLoaders(Set<ClassLoader> classLoaders)
          Sets the ClassLoader instances that should be used when scanning for classes.
 

Method Detail

setClassLoaders

void setClassLoaders(Set<ClassLoader> classLoaders)
Sets the ClassLoader instances that should be used when scanning for classes. If none is set then the context classloader will be used.

Parameters:
classLoaders - loaders to use when scanning for classes

getClassLoaders

Set<ClassLoader> getClassLoaders()
Gets the ClassLoader instances that should be used when scanning for classes.

Returns:
the class loaders to use

addClassLoader

void addClassLoader(ClassLoader classLoader)
Adds the class loader to the existing loaders

Parameters:
classLoader - the loader to add

findAnnotated

Set<Class> findAnnotated(Class<? extends Annotation> annotation,
                         String... packageNames)
Attempts to discover classes that are annotated with to the annotation.

Parameters:
annotation - the annotation that should be present on matching classes
packageNames - one or more package names to scan (including subpackages) for classes
Returns:
the classes found, returns an empty set if none found

findAnnotated

Set<Class> findAnnotated(Set<Class<? extends Annotation>> annotations,
                         String... packageNames)
Attempts to discover classes that are annotated with to the annotation.

Parameters:
annotations - the annotations that should be present (any of them) on matching classes
packageNames - one or more package names to scan (including subpackages) for classes
Returns:
the classes found, returns an empty set if none found

findImplementations

Set<Class> findImplementations(Class parent,
                               String... packageNames)
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.

Parameters:
parent - the class of interface to find subclasses or implementations of
packageNames - one or more package names to scan (including subpackages) for classes
Returns:
the classes found, returns an empty set if none found

findByFilter

Set<Class> findByFilter(PackageScanFilter fiter,
                        String... packageNames)
Attemsp to discover classes filter by the provided filter

Parameters:
fiter - filter to filter desired classes.
packageNames - one or more package names to scan (including subpackages) for classes
Returns:
the classes found, returns an empty set if none found

addFilter

void addFilter(PackageScanFilter filter)
Add a filter that will be applied to all scan operations

Parameters:
filter - filter to filter desired classes in all scan operations


Apache CAMEL