org.apache.sling.jcr.resource.internal.helper
Class ResourcePathIterator

java.lang.Object
  extended by org.apache.sling.jcr.resource.internal.helper.ResourcePathIterator
All Implemented Interfaces:
Iterator<String>

public class ResourcePathIterator
extends Object
implements Iterator<String>

Iterate over the the HTTP request path by creating shorter segments of that path using "." as a separator.

For example, if path = /some/stuff.a4.html/xyz.ext the sequence is:

  1. /some/stuff.a4.html/xyz.ext
  2. /some/stuff.a4.html/xyz
  3. /some/stuff.a4
  4. /some/stuff

The root path (/) is never returned.


Constructor Summary
ResourcePathIterator(String path)
          Creates a new instance iterating over the given path
 
Method Summary
 boolean hasNext()
           
 String next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourcePathIterator

public ResourcePathIterator(String path)
Creates a new instance iterating over the given path

Parameters:
path - The path to iterate over. If this is empty or null this iterator will not return anything.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<String>

next

public String next()
Specified by:
next in interface Iterator<String>

remove

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


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