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

public Class Resources

extends DataType
implements AppendableResourceCollection
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.types.resources.AppendableResourceCollection, org.apache.tools.ant.types.ResourceCollection, java.lang.Iterable
Imports
java.io.File, java.util.AbstractCollection, .ArrayList, .Collection, .Collections, .Iterator, .List, .NoSuchElementException, .Optional, .Spliterator, .Spliterators, .Stack, java.util.stream.Collectors, .Stream, .StreamSupport, org.apache.tools.ant.BuildException, .Project, org.apache.tools.ant.types.DataType, .Resource, .ResourceCollection

Generic ResourceCollection: Either stores nested ResourceCollections, making no attempt to remove duplicates, or references another ResourceCollection.
Since
Ant 1.7

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
private volatile boolean
private Optional<Collection<Resource>>
public static final Iterator<Resource>
public static final ResourceCollection
private List<ResourceCollection>
Inherited from org.apache.tools.ant.types.DataType:
checkedref

Constructor Summary

AccessConstructor and Description
public
Resources()

Create a new Resources.

public
Resources(Project project)

Create a new Resources.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
protected 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 base implementation to recurse on all DataType child elements that may have been added.
private synchronized List<ResourceCollection>
private ResourceCollection

Returns:

the referenced ResourceCollection.
getRef
()

Resolves references, allowing any ResourceCollection.

private synchronized Stream<Resource>
protected void
invalidateExistingIterators()

Allow subclasses to notify existing Iterators they have experienced concurrent modification.

public boolean

Returns:

true if all Resources represent files.
isFilesystemOnly
()

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

Fulfill the ResourceCollection contract.
public synchronized Iterator<Resource>

Returns:

an Iterator of Resources.
iterator
()

Implements java.lang.Iterable.iterator.

Fulfill the ResourceCollection contract.
public void
setCache(boolean
boolean cache flag.
b
)

Set whether to cache collections.

public synchronized int

Returns:

number of elements as int.
size
()

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

Fulfill the ResourceCollection contract.
public synchronized String

Returns:

a descriptive String.
toString
()

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

Format this Resources as a String.
private synchronized void
Inherited from org.apache.tools.ant.types.DataType:
checkAttributesAllowedcheckChildrenAllowedcircularReferenceclonedieOnCircularReferencedieOnCircularReferencegetCheckedRefgetCheckedRefgetCheckedRefgetCheckedRefgetCheckedRefgetDataTypeNamegetRefidinvokeCircularReferenceCheckisCheckedisReferencenoChildrenAllowedpushAndInvokeCircularReferenceChecksetCheckedsetRefidtooManyAttributes

Field Detail

cacheback to summary
private volatile boolean cache
cacheCollback to summary
private Optional<Collection<Resource>> cacheColl
EMPTY_ITERATORback to summary
public static final Iterator<Resource> EMPTY_ITERATOR

static empty Iterator

NONEback to summary
public static final ResourceCollection NONE

static empty ResourceCollection

rcback to summary
private List<ResourceCollection> rc

Constructor Detail

Resourcesback to summary
public Resources()

Create a new Resources.

Resourcesback to summary
public Resources(Project project)

Create a new Resources.

Parameters
project:Project

Project

Since
Ant 1.8

Method Detail

addback to summary
public synchronized void add(ResourceCollection c)

Implements org.apache.tools.ant.types.resources.AppendableResourceCollection.add.

Add a ResourceCollection.

Parameters
c:ResourceCollection

the ResourceCollection to add.

Annotations
@Override
dieOnCircularReferenceback to summary
protected void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException

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

Overrides the base implementation 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.
getNestedback to summary
private synchronized List<ResourceCollection> getNested()
getRefback to summary
private ResourceCollection getRef()

Resolves references, allowing any ResourceCollection.

Returns:ResourceCollection

the referenced ResourceCollection.

internalResourcesback to summary
private synchronized Stream<Resource> internalResources()
invalidateExistingIteratorsback to summary
protected void invalidateExistingIterators()

Allow subclasses to notify existing Iterators they have experienced concurrent modification.

isFilesystemOnlyback to summary
public boolean isFilesystemOnly()

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

Fulfill the ResourceCollection contract.

Returns:boolean

true if all Resources represent files.

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

Implements java.lang.Iterable.iterator.

Fulfill the ResourceCollection contract.

Returns:Iterator<Resource>

an Iterator of Resources.

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

Set whether to cache collections.

Parameters
b:boolean

boolean cache flag.

Since
Ant 1.8.0
sizeback to summary
public synchronized int size()

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

Fulfill the ResourceCollection contract.

Returns:int

number of elements as int.

Annotations
@Override
toStringback to summary
public synchronized String toString()

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

Format this Resources as a String.

Returns:String

a descriptive String.

Annotations
@Override
validateback to summary
private synchronized void validate()
org.apache.tools.ant.types.resources back to summary

private Class Resources.MyCollection

extends AbstractCollection<Resource>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private volatile Collection<Resource>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private synchronized Collection<Resource>
public Iterator<Resource>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Returns an iterator over the elements contained in this collection.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Returns the number of elements in this collection.
Inherited from java.util.AbstractCollection:
addaddAllclearcontainscontainsAllisEmptyremoveremoveAllretainAlltoArraytoArraytoString

Field Detail

cachedback to summary
private volatile Collection<Resource> cached

Constructor Detail

MyCollectionback to summary
private MyCollection()

Method Detail

getCacheback to summary
private synchronized Collection<Resource> getCache()
iteratorback to summary
public Iterator<Resource> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Doc from java.util.AbstractCollection.iterator.

Returns an iterator over the elements contained in this collection.

Returns:Iterator<Resource>

an iterator over the elements contained in this collection

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Doc from java.util.Collection.size.

Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this collection

Annotations
@Override
org.apache.tools.ant.types.resources back to summary

private Class Resources.MyIterator

extends Object
implements Iterator<Resource>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private Iterator<ResourceCollection>
private Iterator<Resource>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Resource
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rciback to summary
private Iterator<ResourceCollection> rci
riback to summary
private Iterator<Resource> ri

Constructor Detail

MyIteratorback to summary
private MyIterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Resource next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Resource

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override