org.apache.camel.impl.converter
Class CorePackageScanClassResolver

java.lang.Object
  extended by org.apache.camel.impl.converter.CorePackageScanClassResolver
All Implemented Interfaces:
PackageScanClassResolver

public class CorePackageScanClassResolver
extends Object
implements PackageScanClassResolver

A ClassResolver which loads type converters from a hardcoded list of classes.

Important: Whenever a new type converter class is added to camel-core then the class should be added to the list in this class.

See Also:
CoreTypeConverterLoader

Field Summary
protected  org.slf4j.Logger log
           
 
Constructor Summary
CorePackageScanClassResolver()
           
 
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 filter, String... packageNames)
          Attempts 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 removeFilter(PackageScanFilter filter)
          Removes the filter
 void setClassLoaders(Set<ClassLoader> classLoaders)
          Sets the ClassLoader instances that should be used when scanning for classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.slf4j.Logger log
Constructor Detail

CorePackageScanClassResolver

public CorePackageScanClassResolver()
Method Detail

setClassLoaders

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

Specified by:
setClassLoaders in interface PackageScanClassResolver
Parameters:
classLoaders - loaders to use when scanning for classes

getClassLoaders

public Set<ClassLoader> getClassLoaders()
Description copied from interface: PackageScanClassResolver
Gets the ClassLoader instances that should be used when scanning for classes.

This implementation will return a new unmodifiable set containing the classloaders. Use the PackageScanClassResolver.addClassLoader(ClassLoader) method if you want to add new classloaders to the class loaders list.

Specified by:
getClassLoaders in interface PackageScanClassResolver
Returns:
the class loaders to use

addClassLoader

public void addClassLoader(ClassLoader classLoader)
Description copied from interface: PackageScanClassResolver
Adds the class loader to the existing loaders

Specified by:
addClassLoader in interface PackageScanClassResolver
Parameters:
classLoader - the loader to add

findAnnotated

public Set<Class<?>> findAnnotated(Class<? extends Annotation> annotation,
                                   String... packageNames)
Description copied from interface: PackageScanClassResolver
Attempts to discover classes that are annotated with to the annotation.

Specified by:
findAnnotated in interface PackageScanClassResolver
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

public Set<Class<?>> findAnnotated(Set<Class<? extends Annotation>> annotations,
                                   String... packageNames)
Description copied from interface: PackageScanClassResolver
Attempts to discover classes that are annotated with to the annotation.

Specified by:
findAnnotated in interface PackageScanClassResolver
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

public Set<Class<?>> findImplementations(Class<?> parent,
                                         String... packageNames)
Description copied from interface: PackageScanClassResolver
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.

Specified by:
findImplementations in interface PackageScanClassResolver
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

public Set<Class<?>> findByFilter(PackageScanFilter filter,
                                  String... packageNames)
Description copied from interface: PackageScanClassResolver
Attempts to discover classes filter by the provided filter

Specified by:
findByFilter in interface PackageScanClassResolver
Parameters:
filter - 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

public void addFilter(PackageScanFilter filter)
Description copied from interface: PackageScanClassResolver
Add a filter that will be applied to all scan operations

Specified by:
addFilter in interface PackageScanClassResolver
Parameters:
filter - filter to filter desired classes in all scan operations

removeFilter

public void removeFilter(PackageScanFilter filter)
Description copied from interface: PackageScanClassResolver
Removes the filter

Specified by:
removeFilter in interface PackageScanClassResolver
Parameters:
filter - filter to filter desired classes in all scan operations


Apache CAMEL