org.apache.sling.servlets.resolver.internal.helper
Class LocationIterator

java.lang.Object
  extended by org.apache.sling.servlets.resolver.internal.helper.LocationIterator
All Implemented Interfaces:
Iterator<String>

public class LocationIterator
extends Object
implements Iterator<String>

The LocationIterator 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:

  1. /apps/sample
  2. /libs/sample
  3. /apps/super
  4. /libs/super
  5. /apps/default
  6. /libs/default


Constructor Summary
LocationIterator(String resourceType, String resourceSuperType, String baseResourceType, String workspaceName, ResourceResolver resolver)
          Creates an instance of this iterator starting with a location built from the resource type of the resource and ending with the given baseResourceType.
 
Method Summary
 boolean hasNext()
          Returns true if there is another entry
 String 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
 

Constructor Detail

LocationIterator

public LocationIterator(String resourceType,
                        String resourceSuperType,
                        String baseResourceType,
                        String workspaceName,
                        ResourceResolver resolver)
Creates an instance of this iterator starting with a location built from the resource type of the resource and ending with the given baseResourceType.

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()
Returns true if there is another entry

Specified by:
hasNext in interface Iterator<String>

next

public String next()
Returns the next entry of this iterator.

Specified by:
next in interface Iterator<String>
Throws:
NoSuchElementException - if hasNext() returns false.

remove

public void remove()
Specified by:
remove in interface Iterator<String>
Throws:
UnsupportedOperationException


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.