org.apache.woden.xpointer
Class ElementPointerPart

java.lang.Object
  extended by org.apache.woden.xpointer.ElementPointerPart
All Implemented Interfaces:
PointerPart

public class ElementPointerPart
extends java.lang.Object
implements PointerPart

ElementPointerPart is a class which represents the element() scheme for the XPointer Framework. The specification is defined at http://www.w3.org/TR/xptr-element/ This class is immutable.

Author:
Dan Harvey (danharvey42@gmail.com)

Constructor Summary
ElementPointerPart(java.util.List childSequence)
          Constructs an ElementPointerPart with only a childSequence.
ElementPointerPart(NCName elementID)
          Constructs an ElementPointerPart with only an elementID NCName.
ElementPointerPart(NCName elementID, java.util.List childSequence)
          Constructs an ElementPointerPart with both an NCName and a childSequence.
 
Method Summary
 java.lang.Integer[] getChildSequence()
          Returns the child sequence of this Element PointerPart.
 NCName getNCName()
          Returns the NCName for this Element PointerPart.
 boolean hasChildSequence()
          Checks if this Element PointerPart has a childSequence or not.
 boolean hasNCName()
          Checks if this Element PointerPart has a NCName or not.
static ElementPointerPart parseFromString(java.lang.String schemeData)
          Deserialises the schemaData for an ElementPointerPart and constructs a new ElementPointerPart from it.
 java.lang.String toString()
          Returns a String serialisation of this xpointer PointerPart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElementPointerPart

public ElementPointerPart(NCName elementID)
Constructs an ElementPointerPart with only an elementID NCName.

Parameters:
elementID - an NCName of the elementID to reference.
Throws:
java.lang.NullPointerException - is a null elementID is given.

ElementPointerPart

public ElementPointerPart(java.util.List childSequence)
Constructs an ElementPointerPart with only a childSequence.

Parameters:
childSequence - a List of Integers representing the child sequence.
Throws:
java.lang.NullPointerException - if childSequence is null.
java.lang.IllegalArgumentException - if childSequence is empty or contains elements other than Integers.

ElementPointerPart

public ElementPointerPart(NCName elementID,
                          java.util.List childSequence)
Constructs an ElementPointerPart with both an NCName and a childSequence.

Parameters:
elementID - an NCName of the elementID to reference.
childSequence - a List of Integers representing the child sequence.
Throws:
java.lang.NullPointerException - if elementID or childSequence are null.
java.lang.IllegalArgumentException - if childSequence is empty or contains elements other than Integers.
Method Detail

getNCName

public NCName getNCName()
Returns the NCName for this Element PointerPart.

Returns:
an NCName if it exists in this Element PointerPart, otherwise null.

getChildSequence

public java.lang.Integer[] getChildSequence()
Returns the child sequence of this Element PointerPart.

Returns:
a Integer[] of the child sequence for this element pointer part, or an empty array if none exists.

hasNCName

public boolean hasNCName()
Checks if this Element PointerPart has a NCName or not.

Returns:
a boolean, true if it has a NCName or false if not.

hasChildSequence

public boolean hasChildSequence()
Checks if this Element PointerPart has a childSequence or not.

Returns:
a boolean, true if this has a childSequence or false if not.

toString

public java.lang.String toString()
Description copied from interface: PointerPart
Returns a String serialisation of this xpointer PointerPart.

Specified by:
toString in interface PointerPart
Overrides:
toString in class java.lang.Object
Returns:
a String containing the serialisation of this xpointer PointerPart.

parseFromString

public static ElementPointerPart parseFromString(java.lang.String schemeData)
                                          throws InvalidXPointerException
Deserialises the schemaData for an ElementPointerPart and constructs a new ElementPointerPart from it.

Parameters:
schemeData - a String of the schemeaData parsed from the string XPointer.
Returns:
an ElementPointerPart representing the parsed schemaData.
Throws:
java.lang.IllegalArgumentException - if the schemeData has invalid scheme syntax.
InvalidXPointerException


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.