org.talend.esb.locator
Class NodePath

java.lang.Object
  extended by org.talend.esb.locator.NodePath

public class NodePath
extends Object

Representation of ZooKeeper node path. The path is always absolute. As path segments obviously cannot contain the path separator ("/") raw paths are always encoded.


Field Summary
static char SEPARATOR
           
 
Constructor Summary
NodePath(String... pathSegments)
          Create an NodePath that consists of the given path segments.
 
Method Summary
 NodePath child(String childNodeName)
          Create a NodePath, which is a child of this one.
static String decode(String encoded)
          Decode the given String.
static String encode(String raw)
          Encode the given String.
 boolean equals(Object obj)
           
 int hashCode()
           
 String toString()
          Encoded String representation of this NodePath.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final char SEPARATOR
See Also:
Constant Field Values
Constructor Detail

NodePath

public NodePath(String... pathSegments)
Create an NodePath that consists of the given path segments.

Parameters:
pathSegments - the sequence of path segments the NodePath consists of, must not be null or empty
Method Detail

child

public NodePath child(String childNodeName)
Create a NodePath, which is a child of this one.

Parameters:
childNodeName - name of the child node, must not be null

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Encoded String representation of this NodePath.

Overrides:
toString in class Object
Returns:
the String representation

encode

public static String encode(String raw)
Encode the given String. All occurrences of "/" are mapped to "%2A" and all occurrences of "%" to "%2F".

Parameters:
raw - the String to encode, must not be null
Returns:
the encoded version
See Also:
decode(String)

decode

public static String decode(String encoded)
Decode the given String. It is the inverse operation of encode(String). For all Strings s, decode(encode(s)).equals(s) should be true.

Parameters:
encoded - the String to decode, must not be null
Returns:
the raw version
See Also:
encode(String)


Copyright © 2011 Talend Inc.. All Rights Reserved.