org.priha.path
Class Path.Component

java.lang.Object
  extended by org.priha.util.QName
      extended by org.priha.path.Path.Component
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<QName>
Enclosing class:
Path

public static class Path.Component
extends QName
implements java.io.Serializable

A Path component consists of a QName with an optional index (to support same name siblings).

This class also stores a rendered version of its own name internally for speed purposes.

See Also:
Serialized Form

Field Summary
static Path.Component ROOT_COMPONENT
          Name of the root component.
 
Constructor Summary
Path.Component(QName name)
           
Path.Component(QName name, int index)
           
Path.Component(java.lang.String localPart)
           
Path.Component(java.lang.String namespaceURI, java.lang.String localpart)
           
 
Method Summary
 int compareTo(QName o)
           
 boolean equals(java.lang.Object o)
           
 int getIndex()
           
 QName getQName()
          Returns a plain QName of this Component (discarding the index).
 java.lang.String toString()
          Returns the QName String representation of the Component, including the index.
 java.lang.String toString(NamespaceMapper ns)
          Returns the String representation of the Component, including the index, using a NamespaceMapper.
static Path.Component valueOf(java.lang.String s)
           
 
Methods inherited from class org.priha.util.QName
getLocalPart, getNamespaceURI, getPrefix, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT_COMPONENT

public static final Path.Component ROOT_COMPONENT
Name of the root component.

Constructor Detail

Path.Component

public Path.Component(java.lang.String localPart)

Path.Component

public Path.Component(java.lang.String namespaceURI,
                      java.lang.String localpart)

Path.Component

public Path.Component(QName name)

Path.Component

public Path.Component(QName name,
                      int index)
Method Detail

getIndex

public final int getIndex()

valueOf

public static Path.Component valueOf(java.lang.String s)

toString

public final java.lang.String toString()
Returns the QName String representation of the Component, including the index.

Overrides:
toString in class QName

toString

public final java.lang.String toString(NamespaceMapper ns)
                                throws javax.jcr.NamespaceException
Returns the String representation of the Component, including the index, using a NamespaceMapper.

The difference between using ns.fromQName(component) and component.toString(ns) is that the first one will NOT return the index. Sometimes this may be desireable.

Throws:
javax.jcr.NamespaceException

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class QName

getQName

public QName getQName()
Returns a plain QName of this Component (discarding the index).

Returns:

compareTo

public int compareTo(QName o)
Specified by:
compareTo in interface java.lang.Comparable<QName>
Overrides:
compareTo in class QName