Top Description Fields Constructors Methods
org.apache.tools.ant.types.resources

public Class MappedResourceCollection

extends DataType
implements ResourceCollection, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, org.apache.tools.ant.types.ResourceCollection, java.lang.Iterable
Imports
java.io.File, java.util.Collection, .Iterator, .Objects, .Stack, java.util.stream.Collectors, .Stream, org.apache.tools.ant.BuildException, .Project, org.apache.tools.ant.types.DataType, .Mapper, .Reference, .Resource, .ResourceCollection, org.apache.tools.ant.util.FileNameMapper, .IdentityMapper, .MergingMapper

Wrapper around a resource collections that maps the names of the other collection using a configured mapper.
Since
Ant 1.8.0

Field Summary

Modifier and TypeField and Description
private boolean
private Collection<Resource>
private boolean
private Mapper
private ResourceCollection
Inherited from org.apache.tools.ant.types.DataType:
checkedref

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
add(ResourceCollection
the ResourceCollection to add.
c
)

Adds the required nested ResourceCollection.

public void
add(FileNameMapper
the mapper to add.
fileNameMapper
)

Add a nested filenamemapper.

private synchronized Collection<Resource>
private void
public Object

Returns:

a cloned instance.
clone
()

Overrides org.apache.tools.ant.types.DataType.clone.

Implement clone.
public Mapper

Returns:

a mapper to be configured.
createMapper
()

Define the mapper to map source to destination files.

protected synchronized void
dieOnCircularReference(Stack<Object>
the stack of data types to use (recursively).
stk
,
Project
the project to use to dereference the references.
p
)

Overrides org.apache.tools.ant.types.DataType.dieOnCircularReference.

Overrides the version of DataType to recurse on all DataType child elements that may have been added.
private Collection<Resource>
private MappedResourceCollection
public boolean
isFilesystemOnly()

Implements org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions.
public Iterator<Resource>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public void
setCache(boolean
boolean
cache
)

Set whether to cache collections.

public void
setEnableMultipleMappings(boolean
If true the type will use all the mappings for a given source path, if false, only the first mapped name is processed. By default, this setting is false to provide backward compatibility with earlier releases.
enableMultipleMappings
)

Set method of handling mappers that return multiple mappings for a given source path.

public void
setRefid(Reference
the Reference to set.
r
)

Overrides org.apache.tools.ant.types.DataType.setRefid.

Overrides the base version.
public int
size()

Implements org.apache.tools.ant.types.ResourceCollection.size.

Learn the number of contained Resources.
public String

Returns:

a descriptive String.
toString
()

Overrides org.apache.tools.ant.types.DataType.toString.

Format this resource collection as a String.
Inherited from org.apache.tools.ant.types.DataType:
checkAttributesAllowedcheckChildrenAllowedcircularReferencedieOnCircularReferencedieOnCircularReferencegetCheckedRefgetCheckedRefgetCheckedRefgetCheckedRefgetCheckedRefgetDataTypeNamegetRefidinvokeCircularReferenceCheckisCheckedisReferencenoChildrenAllowedpushAndInvokeCircularReferenceChecksetCheckedtooManyAttributes

Field Detail

cacheback to summary
private boolean cache
cachedCollback to summary
private Collection<Resource> cachedColl
enableMultipleMappingsback to summary
private boolean enableMultipleMappings
mapperback to summary
private Mapper mapper
nestedback to summary
private ResourceCollection nested

Constructor Detail

MappedResourceCollectionback to summary
public MappedResourceCollection()

Method Detail

addback to summary
public synchronized void add(ResourceCollection c) throws BuildException

Adds the required nested ResourceCollection.

Parameters
c:ResourceCollection

the ResourceCollection to add.

Exceptions
BuildException:
on error.
addback to summary
public void add(FileNameMapper fileNameMapper)

Add a nested filenamemapper.

Parameters
fileNameMapper:FileNameMapper

the mapper to add.

Since
Ant 1.6.3
cacheCollectionback to summary
private synchronized Collection<Resource> cacheCollection()
checkInitializedback to summary
private void checkInitialized()
cloneback to summary
public Object clone()

Overrides org.apache.tools.ant.types.DataType.clone.

Implement clone. The nested resource collection and mapper are copied.

Returns:Object

a cloned instance.

Annotations
@Override
createMapperback to summary
public Mapper createMapper() throws BuildException

Define the mapper to map source to destination files.

Returns:Mapper

a mapper to be configured.

Exceptions
BuildException:
if more than one mapper is defined.
dieOnCircularReferenceback to summary
protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException

Overrides org.apache.tools.ant.types.DataType.dieOnCircularReference.

Overrides the version of DataType to recurse on all DataType child elements that may have been added.

Parameters
stk:Stack<Object>

the stack of data types to use (recursively).

p:Project

the project to use to dereference the references.

Annotations
@Override
Exceptions
BuildException:
on error.
getCollectionback to summary
private Collection<Resource> getCollection()
getRefback to summary
private MappedResourceCollection getRef()
isFilesystemOnlyback to summary
public boolean isFilesystemOnly()

Implements org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Doc from org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions. If true, all resources returned from this collection should respond with a org.apache.tools.ant.types.resources.FileProvider when asked via Resource#as.

Returns:boolean

whether this is a filesystem-only resource collection.

Annotations
@Override
iteratorback to summary
public Iterator<Resource> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<Resource>

an Iterator.

Annotations
@Override
setCacheback to summary
public void setCache(boolean cache)

Set whether to cache collections.

Parameters
cache:boolean

boolean

Since
Ant 1.8.1
setEnableMultipleMappingsback to summary
public void setEnableMultipleMappings(boolean enableMultipleMappings)

Set method of handling mappers that return multiple mappings for a given source path.

Parameters
enableMultipleMappings:boolean

If true the type will use all the mappings for a given source path, if false, only the first mapped name is processed. By default, this setting is false to provide backward compatibility with earlier releases.

Since
Ant 1.8.1
setRefidback to summary
public void setRefid(Reference r)

Overrides org.apache.tools.ant.types.DataType.setRefid.

Overrides the base version.

Parameters
r:Reference

the Reference to set.

Annotations
@Override
sizeback to summary
public int size()

Implements org.apache.tools.ant.types.ResourceCollection.size.

Doc from org.apache.tools.ant.types.ResourceCollection.size.

Learn the number of contained Resources.

Returns:int

number of elements as int.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.apache.tools.ant.types.DataType.toString.

Format this resource collection as a String.

Returns:String

a descriptive String.

Annotations
@Override