org.apache.camel.core.xml.scan
Class PatternBasedPackageScanFilter

java.lang.Object
  extended by org.apache.camel.core.xml.scan.PatternBasedPackageScanFilter
All Implemented Interfaces:
org.apache.camel.spi.PackageScanFilter

public class PatternBasedPackageScanFilter
extends Object
implements org.apache.camel.spi.PackageScanFilter

PatternBasedPackageScanFilter uses an underlying AntPathMatcher to filter scanned files according to include and exclude patterns.

See Also:
AntPathMatcher

Constructor Summary
PatternBasedPackageScanFilter()
           
 
Method Summary
 void addExcludePattern(String excludePattern)
          add and exclude pattern to the filter.
 void addExcludePatterns(Collection<String> excludes)
           
 void addIncludePattern(String includePattern)
          add and include pattern to the filter.
 void addIncludePatterns(Collection<String> includes)
           
 boolean matches(Class<?> candidateClass)
          Tests if a given class matches the patterns in this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternBasedPackageScanFilter

public PatternBasedPackageScanFilter()
Method Detail

addExcludePattern

public void addExcludePattern(String excludePattern)
add and exclude pattern to the filter. Classes matching this pattern will not match the filter


addIncludePattern

public void addIncludePattern(String includePattern)
add and include pattern to the filter. Classes must match one of supplied include patterns to match the filter


addIncludePatterns

public void addIncludePatterns(Collection<String> includes)

addExcludePatterns

public void addExcludePatterns(Collection<String> excludes)

matches

public boolean matches(Class<?> candidateClass)
Tests if a given class matches the patterns in this filter. Patterns are specified by AntPathMatcher

if no include or exclude patterns are set then all classes match.

If the filter contains only include filters, then the candidate class must match one of the include patterns to match the filter and return true.

If the filter contains only exclude filters, then the filter will return true unless the candidate class matches an exclude pattern.

if this contains both include and exclude filters, then the above rules apply with excludes taking precedence over includes i.e. an include pattern of java.util.* and an exclude pattern of java.util.jar.* will include a file only if it is in the util pkg and not in the util.jar package.

Specified by:
matches in interface org.apache.camel.spi.PackageScanFilter
Returns:
true if candidate class matches according to the above rules


Apache CAMEL