com.jayway.restassured.internal.path.xml
Class NodeChildrenImpl
java.lang.Object
com.jayway.restassured.internal.path.xml.NodeBase
com.jayway.restassured.internal.path.xml.NodeChildrenImpl
- All Implemented Interfaces:
- NodeChildren, PathElement, groovy.lang.GroovyObject, Iterable<String>
public class NodeChildrenImpl
- extends NodeBase
- implements NodeChildren, groovy.lang.GroovyObject
NodeChildrenImpl
public NodeChildrenImpl()
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
getNodeList
public Object getNodeList()
setNodeList
public void setNodeList(Object value)
get
public Node get(int index)
- Description copied from interface:
NodeChildren
- The the Node on the nth index
- Specified by:
get in interface NodeChildren
- Parameters:
index - The index of the node the get
- Returns:
- The node
size
public int size()
- Specified by:
size in interface NodeChildren
- Returns:
- The number of children
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface NodeChildren
- Returns:
true if there are no children, false otherwise.
iterator
public Iterator<String> iterator()
- Specified by:
iterator in interface Iterable<String>
leftShift
public Object leftShift(Node node)
toString
public String toString()
- Overrides:
toString in class Object
nodeIterable
public Iterable<Node> nodeIterable()
- Specified by:
nodeIterable in interface NodeChildren
- Returns:
- An iterable of all nodes
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.
nodeIterator
public Iterator<Node> nodeIterator()
- Specified by:
nodeIterator in interface NodeChildren
- Returns:
- An iterator of all nodes.
list
public List<Node> list()
- Specified by:
list in interface NodeChildren
- Returns:
- The child nodes as a list
getList
public <T> List<T> getList(String name)
- Specified by:
getList in class NodeBase
Copyright © 2010-2012. All Rights Reserved.