Package 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
Base class for representing lazy evaluated GPath expressions.
- Author:
- John Wilson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final String
protected final Map
protected final String
protected final GPathResult
-
Constructor Summary
ConstructorsConstructorDescriptionGPathResult
(GPathResult parent, String name, String namespacePrefix, Map<String, String> namespaceTagHints) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
appendNode
(Object newValue) An iterator useful for traversing XML documents/fragments in breadth-first order.abstract Iterator
children()
declareNamespace
(Map newNamespaceMapping) boolean
abstract GPathResult
abstract GPathResult
getAt
(int index) getBody()
getProperty
(String property) Retrieves a property value.boolean
isEmpty()
abstract Iterator
iterator()
list()
lookupNamespace
(String prefix) name()
abstract Iterator
parent()
abstract GPathResult
parents()
void
protected abstract void
replaceBody
(Object newValue) protected abstract void
replaceNode
(Closure newValue) void
setMetaClass
(MetaClass metaClass) Allows the MetaClass to be replaced with a derived implementation.void
setProperty
(String property, Object newValue) Sets the given property to the new value.abstract int
size()
abstract String
text()
toDouble()
toFloat()
toLong()
toString()
toURI()
toURL()
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, invokeMethod
-
Field Details
-
parent
-
name
-
namespacePrefix
-
namespaceMap
-
namespaceTagHints
-
-
Constructor Details
-
GPathResult
public GPathResult(GPathResult parent, String name, String namespacePrefix, Map<String, 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
-
-
Method Details
-
setMetaClass
Description copied from interface:GroovyObject
Allows the MetaClass to be replaced with a derived implementation.- Specified by:
setMetaClass
in interfaceGroovyObject
- Overrides:
setMetaClass
in classGroovyObjectSupport
- Parameters:
metaClass
- the new metaclass
-
getProperty
Description copied from interface:GroovyObject
Retrieves a property value.- Specified by:
getProperty
in interfaceGroovyObject
- Overrides:
getProperty
in classGroovyObjectSupport
- Parameters:
property
- the name of the property of interest- Returns:
- the given property
-
setProperty
Description copied from interface:GroovyObject
Sets the given property to the new value.- Specified by:
setProperty
in interfaceGroovyObject
- Overrides:
setProperty
in classGroovyObjectSupport
- Parameters:
property
- the name of the property of interestnewValue
- the new value for the property
-
leftShift
-
plus
-
replaceNode
-
replaceBody
-
appendNode
-
name
-
parent
-
children
-
lookupNamespace
-
toString
-
toInteger
-
toLong
-
toFloat
-
toDouble
-
toBigDecimal
-
toBigInteger
-
toURL
- Throws:
MalformedURLException
-
toURI
- Throws:
URISyntaxException
-
toBoolean
-
declareNamespace
-
equals
-
getAt
-
getAt
-
putAt
-
depthFirst
-
breadthFirst
An iterator useful for traversing XML documents/fragments in breadth-first order.- Returns:
- Iterator the iterator of GPathResult objects
-
list
-
isEmpty
public boolean isEmpty() -
getBody
-
size
public abstract int size() -
text
-
parents
-
childNodes
-
iterator
-
find
-
findAll
-
nodeIterator
-