groovy.util.slurpersupport
Class GPathResult
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.slurpersupport.GPathResult
- All Implemented Interfaces:
- Buildable, GroovyObject, Writable
- Direct Known Subclasses:
- Attribute, FilteredAttributes, FilteredNodeChildren, NoChildren, NodeChild
public abstract class GPathResult
- extends GroovyObjectSupport
- implements Writable, Buildable
- Author:
- John Wilson
parent
protected final GPathResult parent
name
protected final String name
namespacePrefix
protected final String namespacePrefix
namespaceMap
protected final Map namespaceMap
namespaceTagHints
protected final Map namespaceTagHints
GPathResult
public GPathResult(GPathResult parent,
String name,
String namespacePrefix,
Map namespaceTagHints)
- Parameters:
parent
- name
- namespacePrefix
- namespaceTagHints
-
setMetaClass
public void setMetaClass(MetaClass metaClass)
- Description copied from interface:
GroovyObject
- Allows the MetaClass to be replaced with a derived implementation.
- Specified by:
setMetaClass
in interface GroovyObject
- Overrides:
setMetaClass
in class GroovyObjectSupport
- Parameters:
metaClass
- the new metaclass
getProperty
public Object getProperty(String property)
- Description copied from interface:
GroovyObject
- Retrieves a property value.
- Specified by:
getProperty
in interface GroovyObject
- Overrides:
getProperty
in class GroovyObjectSupport
- Parameters:
property
- the name of the property of interest
- Returns:
- the given property
setProperty
public void setProperty(String property,
Object newValue)
- Description copied from interface:
GroovyObject
- Sets the given property to the new value.
- Specified by:
setProperty
in interface GroovyObject
- Overrides:
setProperty
in class GroovyObjectSupport
- Parameters:
property
- the name of the property of interestnewValue
- the new value for the property
leftShift
public Object leftShift(Object newValue)
plus
public Object plus(Object newValue)
replaceNode
protected abstract void replaceNode(Closure newValue)
replaceBody
protected abstract void replaceBody(Object newValue)
appendNode
protected abstract void appendNode(Object newValue)
name
public String name()
parent
public GPathResult parent()
children
public GPathResult children()
lookupNamespace
public String lookupNamespace(String prefix)
toString
public String toString()
- Overrides:
toString
in class Object
toInteger
public Integer toInteger()
toLong
public Long toLong()
toFloat
public Float toFloat()
toDouble
public Double toDouble()
toBigDecimal
public BigDecimal toBigDecimal()
toBigInteger
public BigInteger toBigInteger()
toURL
public URL toURL()
throws MalformedURLException
- Throws:
MalformedURLException
toURI
public URI toURI()
throws URISyntaxException
- Throws:
URISyntaxException
toBoolean
public Boolean toBoolean()
declareNamespace
public GPathResult declareNamespace(Map newNamespaceMapping)
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
getAt
public Object getAt(int index)
getAt
public Object getAt(IntRange range)
putAt
public void putAt(int index,
Object newValue)
depthFirst
public Iterator depthFirst()
breadthFirst
public Iterator breadthFirst()
- An iterator useful for traversing XML documents/fragments in breadth-first order.
- Returns:
- Iterator the iterator of GPathResult objects
list
public List list()
isEmpty
public boolean isEmpty()
getBody
public Closure getBody()
size
public abstract int size()
text
public abstract String text()
parents
public abstract GPathResult parents()
childNodes
public abstract Iterator childNodes()
iterator
public abstract Iterator iterator()
find
public abstract GPathResult find(Closure closure)
findAll
public abstract GPathResult findAll(Closure closure)
nodeIterator
public abstract Iterator nodeIterator()