Package org.gradle.api.tasks.util

## Class PatternSet

- java.lang.Object
- - org.gradle.api.tasks.util.PatternSet

- All Implemented Interfaces:
    `AntBuilderAware`, `PatternFilterable`

      public class PatternSet
      extends java.lang.Object
      implements AntBuilderAware, PatternFilterable

  Standalone implementation of `PatternFilterable`.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `` | `PatternSet()` |
    `protected` | `PatternSet​(org.gradle.api.tasks.util.internal.PatternSpecFactory patternSpecFactory)` |
    `protected` | `PatternSet​(PatternSet patternSet)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `addToAntBuilder​(java.lang.Object node, java.lang.String childNodeName)` |
    `PatternSet` | `copyFrom​(PatternFilterable sourcePattern)` |
    `protected PatternSet` | `doCopyFrom​(PatternSet from)` |
    `boolean` | `equals​(java.lang.Object o)` |
    `PatternSet` | `exclude​(Closure closure)` | Adds an exclude spec.
    `PatternSet` | `exclude​(java.lang.Iterable excludes)` | Adds an ANT style exclude pattern.
    `PatternSet` | `exclude​(java.lang.String... excludes)` | Adds an ANT style exclude pattern.
    `PatternSet` | `exclude​(Spec<FileTreeElement> spec)` | Adds an exclude spec.
    `PatternSet` | `excludeSpecs​(java.lang.Iterable<Spec<FileTreeElement>> excludes)` |
    `Spec<FileTreeElement>` | `getAsExcludeSpec()` |
    `Spec<FileTreeElement>` | `getAsIncludeSpec()` |
    `Spec<FileTreeElement>` | `getAsSpec()` |
    `java.util.Set<java.lang.String>` | `getExcludes()` | Returns the set of exclude patterns.
    `java.util.Set<Spec<FileTreeElement>>` | `getExcludeSpecs()` |
    `java.util.Set<java.lang.String>` | `getIncludes()` | Returns the set of include patterns.
    `java.util.Set<Spec<FileTreeElement>>` | `getIncludeSpecs()` |
    `int` | `hashCode()` |
    `PatternSet` | `include​(Closure closure)` | Adds an include spec.
    `PatternSet` | `include​(java.lang.Iterable includes)` | Adds an ANT style include pattern.
    `PatternSet` | `include​(java.lang.String... includes)` | Adds an ANT style include pattern.
    `PatternSet` | `include​(Spec<FileTreeElement> spec)` | Adds an include spec.
    `PatternSet` | `includeSpecs​(java.lang.Iterable<Spec<FileTreeElement>> includeSpecs)` |
    `PatternSet` | `intersect()` |
    `boolean` | `isCaseSensitive()` |
    `boolean` | `isEmpty()` | The PatternSet is considered empty when no includes or excludes have been added.
    `void` | `setCaseSensitive​(boolean caseSensitive)` |
    `PatternSet` | `setExcludes​(java.lang.Iterable<java.lang.String> excludes)` | Set the allowable exclude patterns.
    `PatternSet` | `setIncludes​(java.lang.Iterable<java.lang.String> includes)` | Set the allowable include patterns.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PatternSet

          public PatternSet()

    - #### PatternSet

          protected PatternSet​(PatternSet patternSet)

    - #### PatternSet

          protected PatternSet​(org.gradle.api.tasks.util.internal.PatternSpecFactory patternSpecFactory)

  - ### Method Detail

    - #### equals

          public boolean equals​(@Nullable
                                java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### copyFrom

          public PatternSet copyFrom​(PatternFilterable sourcePattern)

    - #### doCopyFrom

          protected PatternSet doCopyFrom​(PatternSet from)

    - #### intersect

          public PatternSet intersect()

    - #### isEmpty

          public boolean isEmpty()

      The PatternSet is considered empty when no includes or excludes have been added. The Spec returned by getAsSpec method only contains the default excludes patterns in this case.
      Returns:
        true when no includes or excludes have been added to this instance

    - #### getAsSpec

          public Spec<FileTreeElement> getAsSpec()

    - #### getAsIncludeSpec

          public Spec<FileTreeElement> getAsIncludeSpec()

    - #### getAsExcludeSpec

          public Spec<FileTreeElement> getAsExcludeSpec()

    - #### getIncludes

          public java.util.Set<java.lang.String> getIncludes()

      Description copied from interface: `PatternFilterable`
      Returns the set of include patterns.
      Specified by:
        `getIncludes` in interface `PatternFilterable`
      Returns:
        The include patterns. Returns an empty set when there are no include patterns.

    - #### getIncludeSpecs

          public java.util.Set<Spec<FileTreeElement>> getIncludeSpecs()

    - #### setIncludes

          public PatternSet setIncludes​(java.lang.Iterable<java.lang.String> includes)

      Description copied from interface: `PatternFilterable`
      Set the allowable include patterns. Note that unlike `PatternFilterable.include(Iterable)` this replaces any previously defined includes.
      Specified by:
        `setIncludes` in interface `PatternFilterable`
      Parameters:
        `includes` - an Iterable providing new include patterns
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### include

          public PatternSet include​(java.lang.String... includes)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `include` in interface `PatternFilterable`
      Parameters:
        `includes` - a vararg list of include patterns
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### include

          public PatternSet include​(java.lang.Iterable includes)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `include` in interface `PatternFilterable`
      Parameters:
        `includes` - a Iterable providing more include patterns
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### include

          public PatternSet include​(Spec<FileTreeElement> spec)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `include` in interface `PatternFilterable`
      Parameters:
        `spec` - the spec to add
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### getExcludes

          public java.util.Set<java.lang.String> getExcludes()

      Description copied from interface: `PatternFilterable`
      Returns the set of exclude patterns.
      Specified by:
        `getExcludes` in interface `PatternFilterable`
      Returns:
        The exclude patterns. Returns an empty set when there are no exclude patterns.

    - #### getExcludeSpecs

          public java.util.Set<Spec<FileTreeElement>> getExcludeSpecs()

    - #### setExcludes

          public PatternSet setExcludes​(java.lang.Iterable<java.lang.String> excludes)

      Description copied from interface: `PatternFilterable`
      Set the allowable exclude patterns. Note that unlike `PatternFilterable.exclude(Iterable)` this replaces any previously defined excludes.
      Specified by:
        `setExcludes` in interface `PatternFilterable`
      Parameters:
        `excludes` - an Iterable providing new exclude patterns
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### isCaseSensitive

          public boolean isCaseSensitive()

    - #### setCaseSensitive

          public void setCaseSensitive​(boolean caseSensitive)

    - #### includeSpecs

          public PatternSet includeSpecs​(java.lang.Iterable<Spec<FileTreeElement>> includeSpecs)

    - #### include

          public PatternSet include​(Closure closure)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `include` in interface `PatternFilterable`
      Parameters:
        `closure` - the spec to add
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### exclude

          public PatternSet exclude​(java.lang.String... excludes)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `exclude` in interface `PatternFilterable`
      Parameters:
        `excludes` - a vararg list of exclude patterns
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### exclude

          public PatternSet exclude​(java.lang.Iterable excludes)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `exclude` in interface `PatternFilterable`
      Parameters:
        `excludes` - a Iterable providing new exclude patterns
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### exclude

          public PatternSet exclude​(Spec<FileTreeElement> spec)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `exclude` in interface `PatternFilterable`
      Parameters:
        `spec` - the spec to add
      Returns:
        this
      See Also:
        `Pattern Format`

    - #### excludeSpecs

          public PatternSet excludeSpecs​(java.lang.Iterable<Spec<FileTreeElement>> excludes)

    - #### exclude

          public PatternSet exclude​(Closure closure)

      Description copied from interface: `PatternFilterable`
      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.
      Specified by:
        `exclude` in interface `PatternFilterable`
      Parameters:
        `closure` - the spec to add
      Returns:
        this
      See Also:
        `FileTreeElement`

    - #### addToAntBuilder

          public java.lang.Object addToAntBuilder​(java.lang.Object node,
                                                  java.lang.String childNodeName)

      Specified by:
        `addToAntBuilder` in interface `AntBuilderAware`