Package org.ametys.plugins.repository
Class NodeIteratorIterable<A extends AmetysObject>
java.lang.Object
org.ametys.plugins.repository.NodeIteratorIterable<A>
- Type Parameters:
A- the actual type ofAmetysObjects.
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<A>,AmetysObjectIterable<A>
public class NodeIteratorIterable<A extends AmetysObject>
extends Object
implements AmetysObjectIterable<A>
Implementation of
Please note that this implementation only works with NodeIterators containing nodes actually bound to AmetysObjects.
If a node exists in the iterator and does not correspond to an
Unless
If
AmetysObjectIterable based on a underlying JCR NodeIterator.Please note that this implementation only works with NodeIterators containing nodes actually bound to AmetysObjects.
If a node exists in the iterator and does not correspond to an
AmetysObject, an AmetysRepositoryException will be thrown.Unless
AmetysObjectIterator.skip(long) is called on the underlying Iterator,
results are buffered so that one may safely call iterator() more than once,
even if the underlying NodeIterator will be consumed only once.If
AmetysObjectIterator.skip(long) is called, any subsequent call to iterator() will throw an IllegalStateException.-
Constructor Summary
ConstructorsConstructorDescriptionNodeIteratorIterable(AmetysObjectResolver resolver, javax.jcr.NodeIterator iterator, String parentPath, javax.jcr.Session session) Creates aNodeIteratorIterable. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the associated resources.
AnAmetysObjectIterablemust NOT be closed if any of the containedAmetysObjectis still in use.longgetSize()Returns the number of elements in this iterable.iterator()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObjectIterable
spliterator, stream
-
Constructor Details
-
NodeIteratorIterable
public NodeIteratorIterable(AmetysObjectResolver resolver, javax.jcr.NodeIterator iterator, String parentPath, javax.jcr.Session session) Creates aNodeIteratorIterable.- Parameters:
resolver- the applicationAmetysObjectResolver.iterator- the underlyingNodeIterator.parentPath- the parent path in the Ametys hierarchy of allAmetysObjectbeing returned.session- the JCR Session corresponding to the specified NodeIterator
-
-
Method Details
-
getSize
Description copied from interface:AmetysObjectIterableReturns the number of elements in this iterable. If this information is unavailable, returns -1.- Specified by:
getSizein interfaceAmetysObjectIterable<A extends AmetysObject>- Returns:
- a long
-
iterator
- Specified by:
iteratorin interfaceAmetysObjectIterable<A extends AmetysObject>- Specified by:
iteratorin interfaceIterable<A extends AmetysObject>
-
close
Description copied from interface:AmetysObjectIterableClose the associated resources.
AnAmetysObjectIterablemust NOT be closed if any of the containedAmetysObjectis still in use.- Specified by:
closein interfaceAmetysObjectIterable<A extends AmetysObject>- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-