Class LocationIterator
- java.lang.Object
-
- org.apache.sling.servlets.resolver.internal.helper.LocationIterator
-
public class LocationIterator extends Object implements Iterator<String>
TheLocationIterator
provides access to an ordered collection of absolute paths containing potential request handling. The primary order of the collection is the resource type hierarchy with the base resource type at the top. The secondary order is the search path retrieved from the resource resolver.Example: For a node type hierarchy "sample" > "super" > "default" and a search path of [ "/apps", "/libs" ], the iterator would provide access to the following list of paths:
/apps/sample
/libs/sample
/apps/super
/libs/super
/apps/default
/libs/default
-
-
Constructor Summary
Constructors Constructor Description LocationIterator(String resourceType, String resourceSuperType, String baseResourceType, org.apache.sling.api.resource.ResourceResolver resolver)
Creates an instance of this iterator starting with a location built from the resource type of theresource
and ending with the givenbaseResourceType
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Returnstrue
if there is another entryString
next()
Returns the next entry of this iterator.void
remove()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
LocationIterator
public LocationIterator(String resourceType, String resourceSuperType, String baseResourceType, org.apache.sling.api.resource.ResourceResolver resolver)
Creates an instance of this iterator starting with a location built from the resource type of theresource
and ending with the givenbaseResourceType
.- Parameters:
resourceType
- the initial resource type.resourceSuperType
- the initial resource super type.baseResourceType
- The base resource type.resolver
- The resource resolver
-
-
Method Detail
-
hasNext
public boolean hasNext()
Returnstrue
if there is another entry
-
next
public String next()
Returns the next entry of this iterator.- Specified by:
next
in interfaceIterator<String>
- Throws:
NoSuchElementException
- ifhasNext()
returnsfalse
.
-
remove
public void remove()
- Specified by:
remove
in interfaceIterator<String>
- Throws:
UnsupportedOperationException
-
-