com.jayway.restassured.internal.path.xml
Class NodeImpl

java.lang.Object
  extended by com.jayway.restassured.internal.path.xml.NodeBase
      extended by com.jayway.restassured.internal.path.xml.NodeImpl
All Implemented Interfaces:
Node, PathElement, groovy.lang.GroovyObject, Iterable<String>

public class NodeImpl
extends NodeBase
implements Node, groovy.lang.GroovyObject


Nested Class Summary
 class NodeImpl.ValueIterator
           
 
Constructor Summary
NodeImpl()
           
 
Method Summary
 Map<String,String> attributes()
          The node attributes, may be empty.
 NodeChildren children()
          The node children
<T> T
get(String name)
          Get a value from the current XML object.
 String getAttribute(String name)
          Get the value of an attribute.
 Object getAttributes()
           
 boolean getBoolean(String name)
           
 byte getByte(String name)
           
 char getChar(String name)
           
 NodeChildren getChildren()
           
 double getDouble(String name)
           
 float getFloat(String name)
           
 int getInt(String name)
           
<T> List<T>
getList(String name)
           
 long getLong(String name)
           
 groovy.lang.MetaClass getMetaClass()
           
 Object getName()
           
 Object getProperty(String property)
           
 short getShort(String name)
           
 Object getValue()
           
 Object invokeMethod(String method, Object arguments)
           
 Iterator<String> iterator()
           
 String name()
          The name of the node
 void setAttributes(Object value)
           
 void setChildren(NodeChildren value)
           
 void setMetaClass(groovy.lang.MetaClass mc)
           
 void setName(Object value)
           
 void setProperty(String property, Object value)
           
 void setValue(Object value)
           
 String toString()
           
 String value()
          The node value.
 
Methods inherited from class com.jayway.restassured.internal.path.xml.NodeBase
get, getNode, getNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jayway.restassured.path.xml.element.PathElement
getNode, getNodes
 

Constructor Detail

NodeImpl

public NodeImpl()
Method Detail

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject
Overrides:
getMetaClass in class NodeBase

setMetaClass

public void setMetaClass(groovy.lang.MetaClass mc)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject
Overrides:
setMetaClass in class NodeBase

invokeMethod

public Object invokeMethod(String method,
                           Object arguments)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class NodeBase

getProperty

public Object getProperty(String property)
Specified by:
getProperty in interface groovy.lang.GroovyObject
Overrides:
getProperty in class NodeBase

setProperty

public void setProperty(String property,
                        Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject
Overrides:
setProperty in class NodeBase

getAttributes

public Object getAttributes()

setAttributes

public void setAttributes(Object value)

getChildren

public NodeChildren getChildren()

setChildren

public void setChildren(NodeChildren value)

getName

public Object getName()

setName

public void setName(Object value)

getValue

public Object getValue()

setValue

public void setValue(Object value)

attributes

public Map<String,String> attributes()
Description copied from interface: Node
The node attributes, may be empty.

Specified by:
attributes in interface Node
Returns:
The attributes associated with this node.

name

public String name()
Description copied from interface: Node
The name of the node

Specified by:
name in interface Node
Returns:
The name of the node

iterator

public Iterator<String> iterator()
Specified by:
iterator in interface Iterable<String>

toString

public String toString()
Overrides:
toString in class Object

children

public NodeChildren children()
Description copied from interface: Node
The node children

Specified by:
children in interface Node
Returns:
The node children

getAttribute

public String getAttribute(String name)
Description copied from interface: Node
Get the value of an attribute.

Specified by:
getAttribute in interface Node
Parameters:
name - The name of the attribute to get
Returns:
The value of the attribute or null if no attribute with the given name was found.

getFloat

public float getFloat(String name)

getDouble

public double getDouble(String name)

getChar

public char getChar(String name)

getBoolean

public boolean getBoolean(String name)

getLong

public long getLong(String name)

getInt

public int getInt(String name)

getShort

public short getShort(String name)

getByte

public byte getByte(String name)

get

public <T> T get(String name)
Description copied from interface: PathElement
Get a value from the current XML object.

This method returns the child whose name matches name. If several children matches the name then a List of Node's are returned.

If this object is a Node and you want to return an attribute value you need to prefix the name with an @. E.g. given

   <category type="present">
      <item when="Aug 10">
         <name>Kathryn's Birthday</name>
         <price>200</price>
      </item>
   </category>
 
then
  String type = node.get("@type");
 
will return "present".

Specified by:
get in interface PathElement
Specified by:
get in class NodeBase
Type Parameters:
T - The expected type of the return value.
Parameters:
name - The name of the child, children or attribute.
Returns:
A Node, a list of nodes, an attribute value or null if not found.

value

public String value()
Description copied from interface: Node
The node value. Will return null unless this node is a leaf node in the XML document.

Specified by:
value in interface Node
Returns:
The node value.

getList

public <T> List<T> getList(String name)
Specified by:
getList in class NodeBase


Copyright © 2010-2012. All Rights Reserved.