Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.service.cmr.repository
Class Path
java.lang.Object
  org.alfresco.service.cmr.repository.Path
All Implemented Interfaces:
Iterable<org.alfresco.service.cmr.repository.Path.Element>, Serializable

public final class Path
extends Object
implements Iterable<org.alfresco.service.cmr.repository.Path.Element>, Serializable
Representation of a simple path e.g.
   /x/y/z
 
In the above example, there will be 4 elements, the first being a reference to the root node, followed by qname elements for x, y and z.

Methods and constructors are available to construct a Path instance from a path string or by building the path incrementally, including the ability to append and prepend path elements.

Path elements supported:

Author:
Derek Hulley
See Also:
Serialized Form

Nested Class Summary
static class
Path.ChildAssocElement
          Represents a qualified path between a parent and a child node, including the sibling to retrieve e.g.
Constructor Summary
Path()
Method Summary
append(Path path)
          Append the given path of this path.
append(org.alfresco.service.cmr.repository.Path.Element pathElement)
          Appends a path element to the end of the path
boolean
equals(Object o)
          Override equals to check equality of Path instances
org.alfresco.service.cmr.repository.Path.Element
first()
org.alfresco.service.cmr.repository.Path.Element
get(int n)
getBaseNamePath(TenantService tenantService)
int
hashCode()
          Override hashCode to check hash equality of Path instances
Iterator<org.alfresco.service.cmr.repository.Path.Element>
iterator()
org.alfresco.service.cmr.repository.Path.Element
last()
prepend(Path path)
          Merge the given path into the beginning of this path.
prepend(org.alfresco.service.cmr.repository.Path.Element pathElement)
          Add a path element to the beginning of the path.
int
size()
subPath(int depth)
          Return a new Path representing this path to the specified depth
subPath(int start, int end)
          Return a new Path representing this path to the specified depth For example, subPath(2, 4) would return the third and forth elements in the Path.
toDisplayPath(NodeService nodeService, PermissionService permissionService)
          Return the human readable form of the specified node Path.
toPrefixString(NamespacePrefixResolver resolver)
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Constructor Detail
Path
public Path()
Method Detail
iterator
public Iterator<org.alfresco.service.cmr.repository.Path.Element> iterator()
Specified by:
iterator in interface Iterable<T>
Returns:
Returns a typed iterator over the path elements

prepend
public Path prepend(org.alfresco.service.cmr.repository.Path.Element pathElement)
Add a path element to the beginning of the path. This operation is useful in cases where a path is built by traversing up a hierarchy.
Parameters:
pathElement - Path.Element
Returns:
Returns this instance of the path

prepend
public Path prepend(Path path)
Merge the given path into the beginning of this path.
Parameters:
path - Path
Returns:
Returns this instance of the path

append
public Path append(org.alfresco.service.cmr.repository.Path.Element pathElement)
Appends a path element to the end of the path
Parameters:
pathElement - Path.Element
Returns:
Returns this instance of the path

append
public Path append(Path path)
Append the given path of this path.
Parameters:
path - Path
Returns:
Returns this instance of the path

first
public org.alfresco.service.cmr.repository.Path.Element first()
Returns:
Returns the first element in the path or null if the path is empty

last
public org.alfresco.service.cmr.repository.Path.Element last()
Returns:
Returns the last element in the path or null if the path is empty

size
public int size()

get
public org.alfresco.service.cmr.repository.Path.Element get(int n)

toString
public String toString()
Overrides:
toString in class Object
Returns:
Returns a string path made up of the component elements of this instance

toPrefixString
public String toPrefixString(NamespacePrefixResolver resolver)
Returns:
Returns a string path made up of the component elements of this instance (prefixed where appropriate)

toDisplayPath
public String toDisplayPath(NodeService nodeService,
                            PermissionService permissionService)
Return the human readable form of the specified node Path. Slow version of the method that extracts the name of each node in the Path from the supplied NodeService.
Returns:
human readable form of the Path excluding the final element

subPath
public Path subPath(int depth)
Return a new Path representing this path to the specified depth
Parameters:
depth - the path depth (0 based)
Returns:
the sub-path

subPath
public Path subPath(int start,
                    int end)
Return a new Path representing this path to the specified depth For example, subPath(2, 4) would return the third and forth elements in the Path.
Parameters:
start - position (0 based)
end - position (0 based)
Returns:
the sub-path

equals
public boolean equals(Object o)
Override equals to check equality of Path instances
Overrides:
equals in class Object

hashCode
public int hashCode()
Override hashCode to check hash equality of Path instances
Overrides:
hashCode in class Object

getBaseNamePath
public Path getBaseNamePath(TenantService tenantService)

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.