public abstract class NodeBase extends Object implements PathElement, groovy.lang.GroovyObject
| Constructor and Description |
|---|
NodeBase() |
| Modifier and Type | Method and Description |
|---|---|
abstract Object |
get(String name)
Get a value from the current XML object.
|
protected static <T> Object |
get(String name,
Object iterator,
boolean forceList) |
abstract Object |
getBackingGroovyObject() |
abstract <T> List |
getList(String name) |
groovy.lang.MetaClass |
getMetaClass() |
Node |
getNode(String name)
Get a
Node whose name matches the supplied name
from the current XML object. |
List |
getNodes(String name)
Get a list of
Node's whose name matches the supplied name
from the current XML object. |
abstract Object |
getPath(String path)
Get a value from the current XML using Groovy's GPath expression syntax.
|
Object |
getPath(String path,
Class explicitType)
Get a value from the current XML using Groovy's GPath expression syntax.
|
void |
setMetaClass(groovy.lang.MetaClass mc) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, iterator, spliteratorpublic abstract Object get(String name)
PathElement
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".
get in interface PathElementname - The name of the child, children or attribute.public abstract Object getPath(String path)
PathElementgetPath in interface PathElementpath - The GPath expression syntaxpublic Object getPath(String path, Class explicitType)
PathElementgetPath in interface PathElementpath - The GPath expression syntaxexplicitType - Converts the outcome of the GPath expression to tis type if allowedpublic Node getNode(String name)
PathElementNode whose name matches the supplied name
from the current XML object.
Note that there's no guarantee that this method actually
will return a Node. It could result in a .getNode in interface PathElementname - The name of the Node to get.null if non were found.public List getNodes(String name)
PathElementNode's whose name matches the supplied name
from the current XML object.getNodes in interface PathElementname - The name of the Nodes to get.public abstract Object getBackingGroovyObject()
public groovy.lang.MetaClass getMetaClass()
getMetaClass in interface groovy.lang.GroovyObjectpublic void setMetaClass(groovy.lang.MetaClass mc)
setMetaClass in interface groovy.lang.GroovyObjectCopyright © 2010–2022. All rights reserved.