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
Base class for representing lazy evaluated GPath expressions.
Constructor Summary |
GPathResult(GPathResult parent,
java.lang.String name,
java.lang.String namespacePrefix,
java.util.Map<java.lang.String,java.lang.String> namespaceTagHints)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
parent
protected final GPathResult parent
name
protected final java.lang.String name
namespacePrefix
protected final java.lang.String namespacePrefix
namespaceMap
protected final java.util.Map namespaceMap
namespaceTagHints
protected final java.util.Map<java.lang.String,java.lang.String> namespaceTagHints
GPathResult
public GPathResult(GPathResult parent,
java.lang.String name,
java.lang.String namespacePrefix,
java.util.Map<java.lang.String,java.lang.String> namespaceTagHints)
- Parameters:
parent
- the GPathResult prior to the application of the expression creating this GPathResultname
- if the GPathResult corresponds to something with a name, e.g. a nodenamespacePrefix
- the namespace prefix if anynamespaceTagHints
- the known tag to namespace mappings
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 java.lang.Object getProperty(java.lang.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(java.lang.String property,
java.lang.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 java.lang.Object leftShift(java.lang.Object newValue)
plus
public java.lang.Object plus(java.lang.Object newValue)
replaceNode
protected abstract void replaceNode(Closure newValue)
replaceBody
protected abstract void replaceBody(java.lang.Object newValue)
appendNode
protected abstract void appendNode(java.lang.Object newValue)
name
public java.lang.String name()
parent
public GPathResult parent()
children
public GPathResult children()
lookupNamespace
public java.lang.String lookupNamespace(java.lang.String prefix)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
toInteger
public java.lang.Integer toInteger()
toLong
public java.lang.Long toLong()
toFloat
public java.lang.Float toFloat()
toDouble
public java.lang.Double toDouble()
toBigDecimal
public java.math.BigDecimal toBigDecimal()
toBigInteger
public java.math.BigInteger toBigInteger()
toURL
public java.net.URL toURL()
throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
toURI
public java.net.URI toURI()
throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
toBoolean
public java.lang.Boolean toBoolean()
declareNamespace
public GPathResult declareNamespace(java.util.Map newNamespaceMapping)
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
getAt
public java.lang.Object getAt(int index)
getAt
public java.lang.Object getAt(IntRange range)
putAt
public void putAt(int index,
java.lang.Object newValue)
depthFirst
public java.util.Iterator depthFirst()
breadthFirst
public java.util.Iterator breadthFirst()
- An iterator useful for traversing XML documents/fragments in breadth-first order.
- Returns:
- Iterator the iterator of GPathResult objects
list
public java.util.List list()
isEmpty
public boolean isEmpty()
getBody
public Closure getBody()
size
public abstract int size()
text
public abstract java.lang.String text()
parents
public abstract GPathResult parents()
childNodes
public abstract java.util.Iterator childNodes()
iterator
public abstract java.util.Iterator iterator()
find
public abstract GPathResult find(Closure closure)
findAll
public abstract GPathResult findAll(Closure closure)
nodeIterator
public abstract java.util.Iterator nodeIterator()