Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.tasks.util
[Java] Interface PatternFilterable

    public interface PatternFilterable

A `PatternFilterable` represents some file container which Ant-style include and exclude patterns or specs can be applied to.

Patterns may include:

- '*' to match any number of characters
- '?' to match any single character
- '**' to match any number of directories or files

Either '/' or '\' may be used in a pattern to separate directories. Patterns ending with '/' or '\' will have '**' automatically appended.

Examples:

     all files ending with 'jsp' (including subdirectories)
        **/*.jsp

     all files beginning with 'template_' in the level1/level2 directory
        level1/level2/template_*

     all files (including subdirectories) beneath src/main/webapp
       src/main/webapp/

     all files beneath any .svn directory (including subdirectories) under src/main/java
       src/main/java/**/.svn/**

You may also use a closure or Spec to specify which files to include or exclude. The closure or Spec is passed a FileTreeElement, and must return a boolean value.

If no include patterns or specs are specified, then all files in this container will be included. If any include patterns or specs are specified, then a file is included if it matches any of the patterns or specs.

If no exclude patterns or spec are specified, then no files will be excluded. If any exclude patterns or specs are specified, then a file is include only if it matches none of the patterns or specs.

Method Summary
`PatternFilterable` | `exclude(String... excludes)` Adds an ANT style exclude pattern.
`PatternFilterable` | `exclude(Iterable excludes)` Adds an ANT style exclude pattern.
`PatternFilterable` | `exclude(Spec excludeSpec)` Adds an exclude spec.
`PatternFilterable` | `exclude(Closure excludeSpec)` Adds an exclude spec.
`Set` | `getExcludes()` Returns the set of exclude patterns.
`Set` | `getIncludes()` Returns the set of include patterns.
`PatternFilterable` | `include(String... includes)` Adds an ANT style include pattern.
`PatternFilterable` | `include(Iterable includes)` Adds an ANT style include pattern.
`PatternFilterable` | `include(Spec includeSpec)` Adds an include spec.
`PatternFilterable` | `include(Closure includeSpec)` Adds an include spec.
`PatternFilterable` | `setExcludes(Iterable excludes)` Set the allowable exclude patterns.
`PatternFilterable` | `setIncludes(Iterable includes)` Set the allowable include patterns.

Method Detail

### exclude

    public PatternFilterable exclude(String... excludes)

  Adds an ANT style exclude pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
  Parameters:
    `excludes` - a vararg list of exclude patterns
  Returns:
    this
  See Also:
    PatternFilterable

### exclude

    public PatternFilterable exclude(Iterable excludes)

  Adds an ANT style exclude pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
  Parameters:
    `excludes` - a Iterable providing new exclude patterns
  Returns:
    this
  See Also:
    PatternFilterable

### exclude

    public PatternFilterable exclude(Spec excludeSpec)

  Adds an exclude spec. This method may be called multiple times to append new specs. If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
  Parameters:
    `excludeSpec` - the spec to add
  Returns:
    this
  See Also:
    PatternFilterable

### exclude

    public PatternFilterable exclude(Closure excludeSpec)

  Adds an exclude spec. This method may be called multiple times to append new specs.The given closure is passed a FileTreeElement as its parameter. The closure should return true or false. Example:

       copySpec {
         from 'source'
         into 'destination'
         //an example of excluding files from certain configuration:
         exclude { it.file in configurations.someConf.files }
       }

  If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
  Parameters:
    `excludeSpec` - the spec to add
  Returns:
    this
  See Also:
    FileTreeElement

### getExcludes

    public Set getExcludes()

  Returns the set of exclude patterns.
  Returns:
    The exclude patterns. Returns an empty set when there are no exclude patterns.

### getIncludes

    public Set getIncludes()

  Returns the set of include patterns.
  Returns:
    The include patterns. Returns an empty set when there are no include patterns.

### include

    public PatternFilterable include(String... includes)

  Adds an ANT style include pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns to be processed.
  Parameters:
    `includes` - a vararg list of include patterns
  Returns:
    this
  See Also:
    PatternFilterable

### include

    public PatternFilterable include(Iterable includes)

  Adds an ANT style include pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns to be processed.
  Parameters:
    `includes` - a Iterable providing more include patterns
  Returns:
    this
  See Also:
    PatternFilterable

### include

    public PatternFilterable include(Spec includeSpec)

  Adds an include spec. This method may be called multiple times to append new specs. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns or specs to be included.
  Parameters:
    `includeSpec` - the spec to add
  Returns:
    this
  See Also:
    PatternFilterable

### include

    public PatternFilterable include(Closure includeSpec)

  Adds an include spec. This method may be called multiple times to append new specs. The given closure is passed a FileTreeElement as its parameter. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns or specs to be included.
  Parameters:
    `includeSpec` - the spec to add
  Returns:
    this
  See Also:
    PatternFilterable

### setExcludes

    public PatternFilterable setExcludes(Iterable excludes)

  Set the allowable exclude patterns. Note that unlike exclude(Iterable) this replaces any previously defined excludes.
  Parameters:
    `excludes` - an Iterable providing new exclude patterns
  Returns:
    this
  See Also:
    PatternFilterable

### setIncludes

    public PatternFilterable setIncludes(Iterable includes)

  Set the allowable include patterns. Note that unlike include(Iterable) this replaces any previously defined includes.
  Parameters:
    `includes` - an Iterable providing new include patterns
  Returns:
    this
  See Also:
    PatternFilterable

Gradle API 1.1-rc-1