com.day.cq.wcm.commons
Class ResourceIterator<T>

java.lang.Object
  extended by com.day.cq.wcm.commons.ResourceIterator<T>
All Implemented Interfaces:
Iterator<T>

public class ResourceIterator<T>
extends Object
implements Iterator<T>

Implements a generic iterator based on an iterator of resources which adapts the element to the respective adapter type. Resources that cannot be adapted to the specified adapter type are skipped.


Constructor Summary
ResourceIterator(Iterator<org.apache.sling.api.resource.Resource> base, Class<T> adapterType)
          Creates a new iterator that is based on the given resource iterator.
 
Method Summary
 boolean hasNext()
          
 T next()
          
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceIterator

public ResourceIterator(Iterator<org.apache.sling.api.resource.Resource> base,
                        Class<T> adapterType)
Creates a new iterator that is based on the given resource iterator.

Parameters:
base - base iterator
adapterType - adapter type
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface Iterator<T>

next

public T next()

Specified by:
next in interface Iterator<T>

remove

public void remove()

Specified by:
remove in interface Iterator<T>
Throws:
UnsupportedOperationException - always


Copyright © 2009 Day Management AG. All Rights Reserved.