Package adams.core.discovery
Class PropertyPath.Path
- java.lang.Object
-
- adams.core.discovery.PropertyPath.Path
-
- Enclosing class:
- PropertyPath
public static class PropertyPath.Path extends Object
Contains a (property) path structure.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static String
CURRENT_OBJECT
the path for the current object (only used at root).protected List<PropertyPath.PathElement>
m_Elements
the structure.protected String
m_FullPath
the full path.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Path()
default constructor, only used internally.Path(String path)
uses the given dot-path.Path(String[] elements)
uses the given array as elements for the path.Path(List<PropertyPath.PathElement> elements)
uses the vector with PathElement objects to initialize with.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertyPath.Path
append(String subpath)
Adds the subpath to the current list of path elements and returns the extended Path object.protected List<PropertyPath.PathElement>
breakUp(String path)
breaks up the given path and returns it as vector.PropertyPath.PathElement
get(int index)
returns the element at the given index.String
getFullPath()
returns the structure again as a dot-path.boolean
isCurrentObject()
Checks whether this is the special path denoting the current object.static PropertyPath.Path
parsePath(String path)
returns a path object based on the given path string.int
size()
returns the number of path elements of this structure.PropertyPath.Path
subpath(int startIndex)
returns a subpath of the current structure, starting with the specified element index up to the end.PropertyPath.Path
subpath(int startIndex, int endIndex)
returns a subpath of the current structure, starting with the specified element index up.String
toString()
returns the structure again as a dot-path.
-
-
-
Field Detail
-
CURRENT_OBJECT
public static final String CURRENT_OBJECT
the path for the current object (only used at root).- See Also:
- Constant Field Values
-
m_Elements
protected List<PropertyPath.PathElement> m_Elements
the structure.
-
m_FullPath
protected String m_FullPath
the full path.
-
-
Constructor Detail
-
Path
protected Path()
default constructor, only used internally.
-
Path
public Path(String path)
uses the given dot-path.- Parameters:
path
- path in dot-notation
-
Path
public Path(List<PropertyPath.PathElement> elements)
uses the vector with PathElement objects to initialize with.- Parameters:
elements
- the PathElements to use
-
Path
public Path(String[] elements)
uses the given array as elements for the path.- Parameters:
elements
- the path elements to use
-
-
Method Detail
-
breakUp
protected List<PropertyPath.PathElement> breakUp(String path)
breaks up the given path and returns it as vector.- Parameters:
path
- the path to break up- Returns:
- the single elements of the path
-
get
public PropertyPath.PathElement get(int index)
returns the element at the given index.- Parameters:
index
- the index of the element to return- Returns:
- the specified element
-
size
public int size()
returns the number of path elements of this structure.- Returns:
- the number of path elements
-
parsePath
public static PropertyPath.Path parsePath(String path)
returns a path object based on the given path string.- Parameters:
path
- path to work on- Returns:
- the path structure
-
subpath
public PropertyPath.Path subpath(int startIndex)
returns a subpath of the current structure, starting with the specified element index up to the end.- Parameters:
startIndex
- the first element of the subpath- Returns:
- the new subpath
-
subpath
public PropertyPath.Path subpath(int startIndex, int endIndex)
returns a subpath of the current structure, starting with the specified element index up. The endIndex specifies the element that is not part of the new subpath. In other words, the new path contains the elements from "startIndex" up to "(endIndex-1)".- Parameters:
startIndex
- the first element of the subpathendIndex
- the element that is after the last added element- Returns:
- the new subpath
-
append
public PropertyPath.Path append(String subpath)
Adds the subpath to the current list of path elements and returns the extended Path object. Does not change this path object.- Returns:
- the new path
-
isCurrentObject
public boolean isCurrentObject()
Checks whether this is the special path denoting the current object.- Returns:
- true if the current object
- See Also:
CURRENT_OBJECT
-
toString
public String toString()
returns the structure again as a dot-path.
-
getFullPath
public String getFullPath()
returns the structure again as a dot-path.- Returns:
- the path structure as dot-path
-
-