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.
|
Object |
getProperty(String property) |
Object |
invokeMethod(String method,
Object arguments) |
void |
setMetaClass(groovy.lang.MetaClass mc) |
void |
setProperty(String property,
Object value) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, iterator, spliterator
public 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 PathElement
name
- The name of the child, children or attribute.public abstract Object getPath(String path)
PathElement
getPath
in interface PathElement
path
- The GPath expression syntaxpublic Object getPath(String path, Class explicitType)
PathElement
getPath
in interface PathElement
path
- The GPath expression syntaxexplicitType
- Converts the outcome of the GPath expression to tis type if allowedpublic Node getNode(String name)
PathElement
Node
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 PathElement
name
- The name of the Node to get.null
if non were found.public List getNodes(String name)
PathElement
Node
's whose name matches the supplied name
from the current XML object.getNodes
in interface PathElement
name
- The name of the Nodes to get.public abstract Object getBackingGroovyObject()
public groovy.lang.MetaClass getMetaClass()
getMetaClass
in interface groovy.lang.GroovyObject
public void setMetaClass(groovy.lang.MetaClass mc)
setMetaClass
in interface groovy.lang.GroovyObject
public Object invokeMethod(String method, Object arguments)
invokeMethod
in interface groovy.lang.GroovyObject
public Object getProperty(String property)
getProperty
in interface groovy.lang.GroovyObject
Copyright © 2010–2019. All rights reserved.