Package org.oddjob.arooa.registry
Class Path
java.lang.Object
org.oddjob.arooa.registry.Path
- All Implemented Interfaces:
Serializable
Represent the path to a component.
- Author:
- Rob Gordon.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a new path by adding a new path element identified by they id to this path.Create a new path by adding a path to this path.booleanGet the path below the topmost element.getId()getRoot()Get the id of the top element in the path.inthashCode()relativeTo(Path other) Resolve the other path relative to this path.intsize()Return the size or depth of this path.toString()
-
Field Details
-
PATH_SEPARATOR
The path separator.- See Also:
-
-
Constructor Details
-
Path
public Path()Constructor for an empty path. -
Path
-
-
Method Details
-
size
public int size()Return the size or depth of this path. a/b/c has a size of 3.- Returns:
- The size of this path.
-
getRoot
Get the id of the top element in the path. This can be used to lookup the component which contains the component which is the next part of the path.- Returns:
- The id of the topmost element.
-
getId
-
getChildPath
Get the path below the topmost element. This can be used to traverse down to lookup a component- Returns:
- The child path or null if this path is a single element.
-
addId
Create a new path by adding a new path element identified by they id to this path. If the id is null a new null path element will be added.- Parameters:
id- The id of the new path element. May be null.- Returns:
- The new path.
-
getParent
-
addPath
Create a new path by adding a path to this path.- Parameters:
extra- The extra path.- Returns:
- The new path.
-
relativeTo
Resolve the other path relative to this path. if this path is a/b and other is a/b/c/d the resultant relative path is c/d.- Parameters:
other- The other path.- Returns:
- The relative path, null if the other path is not in this hierarchy.
-
equals
-
hashCode
public int hashCode() -
toString
-