org.apache.bval.jsr303.util
Class PathImpl

java.lang.Object
  extended by org.apache.bval.jsr303.util.PathImpl
All Implemented Interfaces:
Serializable, Iterable<Path.Node>, Path

public class PathImpl
extends Object
implements Path, Serializable

Description: object holding the property path as a list of nodes. (Implementation partially based on reference implementation)
This class is not synchronized.

Version:
$Rev: 1166451 $ $Date: 2011-09-08 00:32:26 +0200 (Thu, 08 Sep 2011) $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.validation.Path
Path.Node
 
Field Summary
(package private) static String PROPERTY_PATH_SEPARATOR
           
 
Method Summary
 void addNode(Path.Node node)
          Add a node to this PathImpl.
 void addProperty(String name)
          Encapsulate the node manipulations needed to add a named property to this path.
static PathImpl copy(Path path)
          Copy another Path.
static PathImpl create(String name)
          Create a PathImpl instance representing the specified path.
static PathImpl createPathFromString(String propertyPath)
          Returns a Path instance representing the path described by the given string.
 boolean equals(Object o)
          
 NodeImpl getLeafNode()
          Get the leaf node (if any) from this PathImpl
 PathImpl getPathWithoutLeafNode()
          Return a new PathImpl that represents this minus its leaf node (if present).
 int hashCode()
          
 boolean isRootPath()
          Learn whether this PathImpl points to the root of its graph.
 boolean isSubPathOf(Path path)
          Learn whether path is a parent to this.
 Iterator<Path.Node> iterator()
          
 Path.Node removeLeafNode()
          Trim the leaf node from this PathImpl.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_PATH_SEPARATOR

static final String PROPERTY_PATH_SEPARATOR
See Also:
Constant Field Values
Method Detail

createPathFromString

public static PathImpl createPathFromString(String propertyPath)
Returns a Path instance representing the path described by the given string. To create a root node the empty string should be passed. Note: This signature is to maintain pluggability with the RI impl.

Parameters:
propertyPath - the path as string representation.
Returns:
a Path instance representing the path described by the given string.

create

public static PathImpl create(String name)
Create a PathImpl instance representing the specified path.

Parameters:
name -
Returns:
PathImpl

copy

public static PathImpl copy(Path path)
Copy another Path.

Parameters:
path -
Returns:
new PathImpl

isRootPath

public boolean isRootPath()
Learn whether this PathImpl points to the root of its graph.

Returns:
true if no child nodes

getPathWithoutLeafNode

public PathImpl getPathWithoutLeafNode()
Return a new PathImpl that represents this minus its leaf node (if present).

Returns:
PathImpl

addNode

public void addNode(Path.Node node)
Add a node to this PathImpl.

Parameters:
node - to add

addProperty

public void addProperty(String name)
Encapsulate the node manipulations needed to add a named property to this path.

Parameters:
name -

removeLeafNode

public Path.Node removeLeafNode()
Trim the leaf node from this PathImpl.

Returns:
the node removed
Throws:
IllegalStateException - if no nodes are found

getLeafNode

public NodeImpl getLeafNode()
Get the leaf node (if any) from this PathImpl

Returns:
NodeImpl

iterator

public Iterator<Path.Node> iterator()

Specified by:
iterator in interface Iterable<Path.Node>

isSubPathOf

public boolean isSubPathOf(Path path)
Learn whether path is a parent to this.

Parameters:
path -
Returns:
true if our nodes begin with nodes equal to those found in path

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.