Package org.gradle.api.tasks.util
Class PatternSet
java.lang.Object
org.gradle.api.tasks.util.PatternSet
- All Implemented Interfaces:
AntBuilderAware,PatternFilterable
Standalone implementation of
PatternFilterable.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPatternSet(org.gradle.api.tasks.util.internal.PatternSpecFactory patternSpecFactory) protectedPatternSet(PatternSet patternSet) -
Method Summary
Modifier and TypeMethodDescriptionaddToAntBuilder(Object node, String childNodeName) copyFrom(PatternFilterable sourcePattern) protected PatternSetdoCopyFrom(PatternSet from) booleanAdds an exclude spec.Adds an ANT style exclude pattern.Adds an ANT style exclude pattern.exclude(Spec<FileTreeElement> spec) Adds an exclude spec.excludeSpecs(Iterable<Spec<FileTreeElement>> excludes) Returns the set of exclude patterns.LikegetExcludeSpecs(), but returns a unmodifiable view or empty set.LikegetExcludes(), but returns a unmodifiable view or empty set.Returns the set of include patterns.LikegetIncludeSpecs(), but returns a unmodifiable view or empty set.LikegetIncludes(), but returns a unmodifiable view or empty set.inthashCode()Adds an include spec.Adds an ANT style include pattern.Adds an ANT style include pattern.include(Spec<FileTreeElement> spec) Adds an include spec.includeSpecs(Iterable<Spec<FileTreeElement>> includeSpecs) booleanbooleanisEmpty()The PatternSet is considered empty when no includes or excludes have been added.voidsetCaseSensitive(boolean caseSensitive) setExcludes(Iterable<String> excludes) Set the allowable exclude patterns.setIncludes(Iterable<String> includes) Set the allowable include patterns.
-
Constructor Details
-
PatternSet
public PatternSet() -
PatternSet
-
PatternSet
protected PatternSet(org.gradle.api.tasks.util.internal.PatternSpecFactory patternSpecFactory)
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
copyFrom
-
doCopyFrom
-
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
-
getAsIncludeSpec
-
getAsExcludeSpec
-
getIncludesView
LikegetIncludes(), but returns a unmodifiable view or empty set.Use this if you are only reading from the set, as it avoids allocating a set if not needed.
- Returns:
- the include patterns, or an empty set if none
- Since:
- 8.8
-
getIncludes
Description copied from interface:PatternFilterableReturns the set of include patterns.- Specified by:
getIncludesin interfacePatternFilterable- Returns:
- The include patterns. Returns an empty set when there are no include patterns.
-
getIncludeSpecsView
LikegetIncludeSpecs(), but returns a unmodifiable view or empty set.Use this if you are only reading from the set, as it avoids allocating a set if not needed.
- Returns:
- the include specs, or an empty set if none
- Since:
- 8.8
-
getIncludeSpecs
-
setIncludes
Description copied from interface:PatternFilterableSet the allowable include patterns. Note that unlikePatternFilterable.include(Iterable)this replaces any previously defined includes.- Specified by:
setIncludesin interfacePatternFilterable- Parameters:
includes- an Iterable providing new include patterns- Returns:
- this
- See Also:
-
include
Description copied from interface:PatternFilterableAdds 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:
includein interfacePatternFilterable- Parameters:
includes- a vararg list of include patterns- Returns:
- this
- See Also:
-
include
Description copied from interface:PatternFilterableAdds 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:
includein interfacePatternFilterable- Parameters:
includes- a Iterable providing more include patterns- Returns:
- this
- See Also:
-
include
Description copied from interface:PatternFilterableAdds 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:
includein interfacePatternFilterable- Parameters:
spec- the spec to add- Returns:
- this
- See Also:
-
getExcludesView
LikegetExcludes(), but returns a unmodifiable view or empty set.Use this if you are only reading from the set, as it avoids allocating a set if not needed.
- Returns:
- the exclude patterns, or an empty set if none
- Since:
- 8.8
-
getExcludes
Description copied from interface:PatternFilterableReturns the set of exclude patterns.- Specified by:
getExcludesin interfacePatternFilterable- Returns:
- The exclude patterns. Returns an empty set when there are no exclude patterns.
-
getExcludeSpecsView
LikegetExcludeSpecs(), but returns a unmodifiable view or empty set.Use this if you are only reading from the set, as it avoids allocating a set if not needed.
- Returns:
- the exclude specs, or an empty set if none
- Since:
- 8.8
-
getExcludeSpecs
-
setExcludes
Description copied from interface:PatternFilterableSet the allowable exclude patterns. Note that unlikePatternFilterable.exclude(Iterable)this replaces any previously defined excludes.- Specified by:
setExcludesin interfacePatternFilterable- Parameters:
excludes- an Iterable providing new exclude patterns- Returns:
- this
- See Also:
-
isCaseSensitive
public boolean isCaseSensitive() -
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) -
includeSpecs
-
include
Description copied from interface:PatternFilterableAdds an include spec. This method may be called multiple times to append new specs. The given closure is passed aFileTreeElementas 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:
includein interfacePatternFilterable- Parameters:
closure- the spec to add- Returns:
- this
- See Also:
-
exclude
Description copied from interface:PatternFilterableAdds 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:
excludein interfacePatternFilterable- Parameters:
excludes- a vararg list of exclude patterns- Returns:
- this
- See Also:
-
exclude
Description copied from interface:PatternFilterableAdds 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:
excludein interfacePatternFilterable- Parameters:
excludes- a Iterable providing new exclude patterns- Returns:
- this
- See Also:
-
exclude
Description copied from interface:PatternFilterableAdds 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:
excludein interfacePatternFilterable- Parameters:
spec- the spec to add- Returns:
- this
- See Also:
-
excludeSpecs
-
exclude
Description copied from interface:PatternFilterableAdds an exclude spec. This method may be called multiple times to append new specs.The given closure is passed aFileTreeElementas 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:
excludein interfacePatternFilterable- Parameters:
closure- the spec to add- Returns:
- this
- See Also:
-
addToAntBuilder
- Specified by:
addToAntBuilderin interfaceAntBuilderAware
-