org.apache.tools.ant.types.resources

Class BaseResourceCollectionContainer

public abstract class BaseResourceCollectionContainer extends DataType implements ResourceCollection, Cloneable

Base class for ResourceCollections that nest multiple ResourceCollections.

Since: Ant 1.7

Constructor Summary
BaseResourceCollectionContainer()
Create a new BaseResourceCollectionContainer.
BaseResourceCollectionContainer(Project project)
Create a new BaseResourceCollectionContainer.
Method Summary
voidadd(ResourceCollection c)
Add a ResourceCollection to the container.
voidaddAll(Collection c)
Add the Collection of ResourceCollections to the container.
voidclear()
Clear the container.
Objectclone()
Implement clone.
protected voiddieOnCircularReference(Stack stk, Project p)
Overrides the version of DataType to recurse on all DataType child elements that may have been added.
protected abstract CollectiongetCollection()
Template method for subclasses to return a Collection object of Resources.
ListgetResourceCollections()
Get the nested ResourceCollections.
booleanisCache()
Learn whether to cache collections.
booleanisFilesystemOnly()
Fulfill the ResourceCollection contract.
Iteratoriterator()
Fulfill the ResourceCollection contract.
voidsetCache(boolean b)
Set whether to cache collections.
intsize()
Fulfill the ResourceCollection contract.
StringtoString()
Format this BaseResourceCollectionContainer as a String.

Constructor Detail

BaseResourceCollectionContainer

public BaseResourceCollectionContainer()
Create a new BaseResourceCollectionContainer.

BaseResourceCollectionContainer

public BaseResourceCollectionContainer(Project project)
Create a new BaseResourceCollectionContainer.

Since: Ant 1.8

Method Detail

add

public void add(ResourceCollection c)
Add a ResourceCollection to the container.

Parameters: c the ResourceCollection to add.

Throws: BuildException on error.

addAll

public void addAll(Collection c)
Add the Collection of ResourceCollections to the container.

Parameters: c the Collection whose elements to add.

Throws: BuildException on error.

clear

public void clear()
Clear the container.

Throws: BuildException on error.

clone

public Object clone()
Implement clone. The set of nested resource collections is shallowly cloned.

Returns: a cloned instance.

dieOnCircularReference

protected void dieOnCircularReference(Stack stk, Project p)
Overrides the version of DataType to recurse on all DataType child elements that may have been added.

Parameters: stk the stack of data types to use (recursively). p the project to use to dereference the references.

Throws: BuildException on error.

getCollection

protected abstract Collection getCollection()
Template method for subclasses to return a Collection object of Resources.

Returns: Collection.

getResourceCollections

public final List getResourceCollections()
Get the nested ResourceCollections.

Returns: List.

isCache

public boolean isCache()
Learn whether to cache collections. Default is true.

Returns: boolean cache flag.

isFilesystemOnly

public boolean isFilesystemOnly()
Fulfill the ResourceCollection contract.

Returns: whether this is a filesystem-only resource collection.

iterator

public final Iterator iterator()
Fulfill the ResourceCollection contract. The Iterator returned will throw ConcurrentModificationExceptions if ResourceCollections are added to this container while the Iterator is in use.

Returns: a "fail-fast" Iterator.

setCache

public void setCache(boolean b)
Set whether to cache collections.

Parameters: b boolean cache flag.

size

public int size()
Fulfill the ResourceCollection contract.

Returns: number of elements as int.

toString

public String toString()
Format this BaseResourceCollectionContainer as a String.

Returns: a descriptive String.