Interface ContentFilterable
-
- All Known Subinterfaces:
CopyProcessingSpec,CopySpec,FileCopyDetails
- All Known Implementing Classes:
AbstractArchiveTask,AbstractCopyTask,Copy,Ear,Jar,Jar,ProcessResources,Sync,Tar,War,Zip
public interface ContentFilterableRepresents some binary resource whose content can be filtered.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ContentFilterableexpand(Map<String,?> properties)Expands property references in each file as it is copied.ContentFilterablefilter(Closure closure)Adds a content filter based on the provided closure.ContentFilterablefilter(Class<? extends FilterReader> filterType)Adds a content filter to be used during the copy.ContentFilterablefilter(Map<String,?> properties, Class<? extends FilterReader> filterType)Adds a content filter to be used during the copy.ContentFilterablefilter(Transformer<String,String> transformer)Adds a content filter based on the provided transformer.
-
-
-
Method Detail
-
filter
ContentFilterable filter(Map<String,?> properties, Class<? extends FilterReader> filterType)
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the filter chain. Each filter should implement
java.io.FilterReader. Includeorg.apache.tools.ant.filters.*for access to all the standard Ant filters.Filter properties may be specified using groovy map syntax.
Examples:
filter(HeadFilter, lines:25, skip:2) filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1'])- Parameters:
properties- map of filter propertiesfilterType- Class of filter to add- Returns:
- this
-
filter
ContentFilterable filter(Class<? extends FilterReader> filterType)
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the filter chain. Each filter should implement
java.io.FilterReader. Includeorg.apache.tools.ant.filters.*for access to all the standard Ant filters.Examples:
filter(StripJavaComments) filter(com.mycompany.project.CustomFilter)- Parameters:
filterType- Class of filter to add- Returns:
- this
-
filter
ContentFilterable filter(Closure closure)
Adds a content filter based on the provided closure. The Closure will be called with each line (stripped of line endings) and should return a String to replace the line ornullto remove the line. If every line is removed, the result will be an empty file, not an absent one.- Parameters:
closure- to implement line based filtering- Returns:
- this
-
filter
ContentFilterable filter(Transformer<String,String> transformer)
Adds a content filter based on the provided transformer. The Closure will be called with each line (stripped of line endings) and should return a String to replace the line ornullto remove the line. If every line is removed, the result will be an empty file, not an absent one.- Parameters:
transformer- to implement line based filtering- Returns:
- this
-
expand
ContentFilterable expand(Map<String,?> properties)
Expands property references in each file as it is copied. More specifically, each file is transformed using Groovy's
SimpleTemplateEngine. This means you can use simple property references, such as$propertyor${property}in the file. You can also include arbitrary Groovy code in the file, such as${version ?: 'unknown'}or${classpath*.name.join(' ')}- Parameters:
properties- to implement line based filtering- Returns:
- this
-
-