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

public Class LazyResourceCollectionWrapper

extends AbstractResourceCollectionWrapper
Class Inheritance
Imports
java.util.ArrayList, .Iterator, .List, .NoSuchElementException, java.util.function.Supplier, org.apache.tools.ant.types.Resource

Resource collection which load underlying resource collection only on demand with support for caching

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
LazyResourceCollectionWrapper.CachedIterator

Iterator that will put in the shared cache array list the selected resources

private class

Field Summary

Modifier and TypeField and Description
private final List<Resource>
cachedResources

List of cached resources

private Iterator<Resource>
private final Supplier<Iterator<Resource>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Iterator<Resource>
createIterator()

Implements abstract org.apache.tools.ant.types.resources.AbstractResourceCollectionWrapper.createIterator.

Do create an iterator on the resource collection.
protected boolean

Returns:

whether the resource should be filtered or not
filterResource
(final Resource
resource considered for filtration
r
)

Specify if the resource should be filtered or not.

protected int
getSize()

Implements abstract org.apache.tools.ant.types.resources.AbstractResourceCollectionWrapper.getSize.

Do compute the size of the resource collection.
Inherited from org.apache.tools.ant.types.resources.AbstractResourceCollectionWrapper:
adddieOnCircularReferencegetResourceCollectionisCacheisFilesystemOnlyiteratorsetCachesizetoString

Field Detail

cachedResourcesback to summary
private final List<Resource> cachedResources

List of cached resources

filteringIteratorback to summary
private Iterator<Resource> filteringIterator
filteringIteratorSupplierback to summary
private final Supplier<Iterator<Resource>> filteringIteratorSupplier

Constructor Detail

LazyResourceCollectionWrapperback to summary
public LazyResourceCollectionWrapper()

Method Detail

createIteratorback to summary
protected Iterator<Resource> createIterator()

Implements abstract org.apache.tools.ant.types.resources.AbstractResourceCollectionWrapper.createIterator.

Doc from org.apache.tools.ant.types.resources.AbstractResourceCollectionWrapper.createIterator.

Do create an iterator on the resource collection. The creation of the iterator is allowed to not be thread safe whereas the iterator itself should. The returned iterator will be wrapped into the FailFast one.

Returns:Iterator<Resource>

the iterator on the resource collection

Annotations
@Override
filterResourceback to summary
protected boolean filterResource(final Resource r)

Specify if the resource should be filtered or not. This function should be overridden in order to define the filtering algorithm

Parameters
r:Resource

resource considered for filtration

Returns:boolean

whether the resource should be filtered or not

getSizeback to summary
protected int getSize()

Implements abstract org.apache.tools.ant.types.resources.AbstractResourceCollectionWrapper.getSize.

Doc from org.apache.tools.ant.types.resources.AbstractResourceCollectionWrapper.getSize.

Do compute the size of the resource collection. The implementation of this function is allowed to be not thread safe.

Returns:int

size of resource collection.

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

private Class LazyResourceCollectionWrapper.CachedIterator

extends Object
implements Iterator<Resource>
Class Inheritance
  • java.lang.Object
  • org.apache.tools.ant.types.resources.LazyResourceCollectionWrapper.CachedIterator
All Implemented Interfaces
java.util.Iterator

Iterator that will put in the shared cache array list the selected resources

Field Summary

Modifier and TypeField and Description
pack-priv int
private final Iterator<Resource>

Constructor Summary

AccessConstructor and Description
public
CachedIterator(final Iterator<Resource>
the iterator which will provide the resources to put in cache
it
)

Default constructor

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

cursorback to summary
pack-priv int cursor
itback to summary
private final Iterator<Resource> it

Constructor Detail

CachedIteratorback to summary
public CachedIterator(final Iterator<Resource> it)

Default constructor

Parameters
it:Iterator<Resource>

the iterator which will provide the resources to put in cache

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
org.apache.tools.ant.types.resources back to summary

private Class LazyResourceCollectionWrapper.FilteringIterator

extends Object
implements Iterator<Resource>
Class Inheritance
  • java.lang.Object
  • org.apache.tools.ant.types.resources.LazyResourceCollectionWrapper.FilteringIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
pack-priv boolean
protected final Iterator<Resource>
pack-priv Resource

Constructor Summary

AccessConstructor and Description
pack-priv

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.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endedback to summary
pack-priv boolean ended
itback to summary
protected final Iterator<Resource> it
nextback to summary
pack-priv Resource next

Constructor Detail

FilteringIteratorback to summary
pack-priv FilteringIterator(final Iterator<Resource> it)

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