Package groovy.util.slurpersupport
Class GPathResult
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.slurpersupport.GPathResult
- All Implemented Interfaces:
groovy.lang.Buildable,groovy.lang.GroovyObject,groovy.lang.Writable,Iterable
- Direct Known Subclasses:
Attribute,NoChildren,NodeChild,NodeChildren
@Deprecated public abstract class GPathResult extends groovy.lang.GroovyObjectSupport implements groovy.lang.Writable, groovy.lang.Buildable, Iterable
Deprecated.
Base class for representing lazy evaluated GPath expressions.
-
Field Summary
Fields Modifier and Type Field Description protected StringnameDeprecated.protected MapnamespaceMapDeprecated.protected StringnamespacePrefixDeprecated.protected Map<String,String>namespaceTagHintsDeprecated.protected GPathResultparentDeprecated. -
Constructor Summary
Constructors Constructor Description GPathResult(GPathResult parent, String name, String namespacePrefix, Map<String,String> namespaceTagHints)Deprecated.Creates a new GPathResult namednamewith the parentparent, the namespacePrefixnamespacePrefixand the namespaceTagHints specified in thenamespaceTagHintsMap. -
Method Summary
Modifier and Type Method Description protected abstract voidappendNode(Object newValue)Deprecated.IteratorbreadthFirst()Deprecated.Provides an Iterator over all the nodes of this GPathResult using a breadth-first traversal.abstract IteratorchildNodes()Deprecated.Returns an iterator over the child nodes of this GPathResult.GPathResultchildren()Deprecated.Returns the children of this GPathResult as a GPathResult object.protected IteratorcreateIterator(Object obj)Deprecated.GPathResultdeclareNamespace(Map newNamespaceMapping)Deprecated.Adds the specified map of prefix to namespace mappings to this GPathResult.IteratordepthFirst()Deprecated.Provides an Iterator over all the nodes of this GPathResult using a depth-first traversal.booleanequals(Object obj)Deprecated.abstract GPathResultfind(groovy.lang.Closure closure)Deprecated.Returns the first child of this GPathResult matching the condition(s) specified in the passed closure.abstract GPathResultfindAll(groovy.lang.Closure closure)Deprecated.Returns the children of this GPathResult matching the condition(s) specified in the passed closure.ObjectgetAt(int index)Deprecated.Supports the subscript operator for a GPathResult.ObjectgetAt(groovy.lang.IntRange range)Deprecated.Supports the range subscript operator for a GPathResult.groovy.lang.ClosuregetBody()Deprecated.Creates a Closure representing the body of this GPathResult.ObjectgetProperty(String property)Deprecated.Returns the specified Property of this GPathResult.inthashCode()Deprecated.booleanisEmpty()Deprecated.Returns true if the GPathResult is empty, i.e.abstract Iteratoriterator()Deprecated.ObjectleftShift(Object newValue)Deprecated.Overloads the left shift operator to provide an easy way to lazily append Objects to this GPathResult.Listlist()Deprecated.Creates a list of objects representing this GPathResult.StringlookupNamespace(String prefix)Deprecated.Returns the namespace mapped to the specified prefix.Stringname()Deprecated.Returns the name of this GPathResult.abstract IteratornodeIterator()Deprecated.GPathResultparent()Deprecated.Returns as GPathResult with the parent nodes of the current GPathResultabstract GPathResultparents()Deprecated.Returns the parents of this GPathResult as aGPathResult.Objectplus(Object newValue)Deprecated.Lazily adds the specified Object to this GPathResult.GPathResultpop()Deprecated.Returns the parent of this GPathResult.voidputAt(int index, Object newValue)Deprecated.A helper method to allow GPathResults to work with subscript operatorsprotected abstract voidreplaceBody(Object newValue)Deprecated.protected abstract voidreplaceNode(groovy.lang.Closure newValue)Deprecated.voidsetMetaClass(groovy.lang.MetaClass metaClass)Deprecated.Replaces the MetaClass of this GPathResult.voidsetProperty(String property, Object newValue)Deprecated.Replaces the specified property of this GPathResult with a new value.abstract intsize()Deprecated.Returns the size of this GPathResult.abstract Stringtext()Deprecated.Returns the text of this GPathResult as aString.BigDecimaltoBigDecimal()Deprecated.Converts the text of this GPathResult to a BigDecimal object.BigIntegertoBigInteger()Deprecated.Converts the text of this GPathResult to a BigInteger object.BooleantoBoolean()Deprecated.Converts the text of this GPathResult to a Boolean object.DoubletoDouble()Deprecated.Converts the text of this GPathResult to a Double object.FloattoFloat()Deprecated.Converts the text of this GPathResult to a Float object.IntegertoInteger()Deprecated.Converts the text of this GPathResult to a Integer object.LongtoLong()Deprecated.Converts the text of this GPathResult to a Long object.StringtoString()Deprecated.Returns the text of this GPathResult.URItoURI()Deprecated.Converts the text of this GPathResult to a URI object.URLtoURL()Deprecated.Converts the text of this GPathResult to a URL object.Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClassMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface groovy.lang.Buildable
buildMethods inherited from interface groovy.lang.GroovyObject
invokeMethodMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface groovy.lang.Writable
writeTo
-
Field Details
-
parent
Deprecated. -
name
Deprecated. -
namespacePrefix
Deprecated. -
namespaceMap
Deprecated. -
namespaceTagHints
Deprecated.
-
-
Constructor Details
-
GPathResult
public GPathResult(GPathResult parent, String name, String namespacePrefix, Map<String,String> namespaceTagHints)Deprecated.Creates a new GPathResult namednamewith the parentparent, the namespacePrefixnamespacePrefixand the namespaceTagHints specified in thenamespaceTagHintsMap.- 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
public void setMetaClass(groovy.lang.MetaClass metaClass)Deprecated.Replaces the MetaClass of this GPathResult.- Specified by:
setMetaClassin interfacegroovy.lang.GroovyObject- Overrides:
setMetaClassin classgroovy.lang.GroovyObjectSupport- Parameters:
metaClass- the new MetaClass
-
getProperty
Deprecated.Returns the specified Property of this GPathResult.Realizes the follow shortcuts:
'..'forparent()'*'forchildren()'**'fordepthFirst()'@'for attribute access
- Specified by:
getPropertyin interfacegroovy.lang.GroovyObject- Parameters:
property- the Property to fetch
-
setProperty
Deprecated.Replaces the specified property of this GPathResult with a new value.- Specified by:
setPropertyin interfacegroovy.lang.GroovyObject- Parameters:
property- the property of this GPathResult to replacenewValue- the new value of the property
-
leftShift
Deprecated.Overloads the left shift operator to provide an easy way to lazily append Objects to this GPathResult.- Parameters:
newValue- the Object to append- Returns:
this
-
plus
Deprecated.Lazily adds the specified Object to this GPathResult.- Parameters:
newValue- the Object to add- Returns:
this
-
replaceNode
protected abstract void replaceNode(groovy.lang.Closure newValue)Deprecated. -
replaceBody
Deprecated. -
appendNode
Deprecated. -
name
Deprecated.Returns the name of this GPathResult.- Returns:
- the name of this GPathResult
-
pop
Deprecated.Returns the parent of this GPathResult. If this GPathResult has no parent the GPathResult itself is returned. This is no navigation in the XML tree. It is backtracking on the GPath expression chain. It is the behavior of parent() prior to 2.2.0. Backtracking on '..' actually goes down one level in the tree again. find() and findAll() are popped along with the level they have been applied to.- Returns:
- the parent or
this
-
parent
Deprecated.Returns as GPathResult with the parent nodes of the current GPathResult- Returns:
- the parents GPathResult or
thisfor the root
-
children
Deprecated.Returns the children of this GPathResult as a GPathResult object.- Returns:
- the children of this GPathResult
-
lookupNamespace
Deprecated.Returns the namespace mapped to the specified prefix.- Parameters:
prefix- the prefix lookup- Returns:
- the namespace of the prefix
-
toString
Deprecated.Returns the text of this GPathResult. -
toInteger
Deprecated.Converts the text of this GPathResult to a Integer object.- Returns:
- the GPathResult, converted to a
Integer
-
toLong
Deprecated.Converts the text of this GPathResult to a Long object.- Returns:
- the GPathResult, converted to a
Long
-
toFloat
Deprecated.Converts the text of this GPathResult to a Float object.- Returns:
- the GPathResult, converted to a
Float
-
toDouble
Deprecated.Converts the text of this GPathResult to a Double object.- Returns:
- the GPathResult, converted to a
Double
-
toBigDecimal
Deprecated.Converts the text of this GPathResult to a BigDecimal object.- Returns:
- the GPathResult, converted to a
BigDecimal
-
toBigInteger
Deprecated.Converts the text of this GPathResult to a BigInteger object.- Returns:
- the GPathResult, converted to a
BigInteger
-
toURL
Deprecated.Converts the text of this GPathResult to a URL object.- Returns:
- the GPathResult, converted to a
URL - Throws:
MalformedURLException
-
toURI
Deprecated.Converts the text of this GPathResult to a URI object.- Returns:
- the GPathResult, converted to a
URI - Throws:
URISyntaxException
-
toBoolean
Deprecated.Converts the text of this GPathResult to a Boolean object.- Returns:
- the GPathResult, converted to a
Boolean
-
declareNamespace
Deprecated.Adds the specified map of prefix to namespace mappings to this GPathResult. Already existing prefixes are overwritten.- Parameters:
newNamespaceMapping- the mappings to add- Returns:
this
-
hashCode
public int hashCode()Deprecated. -
equals
Deprecated. -
getAt
Deprecated.Supports the subscript operator for a GPathResult.import groovy.util.slurpersupport.* def text = """ <characterList> <character/> <character> <name>Gromit</name> </character> </characterList>""" GPathResult characterList = new XmlSlurper().parseText(text) assert characterList.character[1].name == 'Gromit'- Parameters:
index- an index- Returns:
- the value at the given index
-
getAt
Deprecated.Supports the range subscript operator for a GPathResult.import groovy.util.slurpersupport.* def text = """ <characterList> <character>Wallace</character> <character>Gromit</character> <character>Shaun</character> </characterList>""" GPathResult characterList = new XmlSlurper().parseText(text) assert characterList.character[1..2].join(',') == 'Gromit,Shaun'- Parameters:
range- a Range indicating the items to get- Returns:
- a new list based on range borders
-
putAt
Deprecated.A helper method to allow GPathResults to work with subscript operators- Parameters:
index- an indexnewValue- the value to put at the given index
-
depthFirst
Deprecated.Provides an Iterator over all the nodes of this GPathResult using a depth-first traversal.- Returns:
- the
Iteratorof (depth-first) ordered GPathResults
-
breadthFirst
Deprecated.Provides an Iterator over all the nodes of this GPathResult using a breadth-first traversal.- Returns:
- the
Iteratorof (breadth-first) ordered GPathResults
-
list
Deprecated.Creates a list of objects representing this GPathResult.- Returns:
- a list representing of this GPathResult
-
isEmpty
public boolean isEmpty()Deprecated.Returns true if the GPathResult is empty, i.e. if, and only if,size()is 0.- Returns:
- true if the GPathResult is empty
-
getBody
public groovy.lang.Closure getBody()Deprecated.Creates a Closure representing the body of this GPathResult.- Returns:
- the body of this GPathResult, converted to a
Closure
-
size
public abstract int size()Deprecated.Returns the size of this GPathResult.- Returns:
- the size of this GPathResult
-
text
Deprecated.Returns the text of this GPathResult as aString.- Returns:
- the text of this GPathResult
-
parents
Deprecated.Returns the parents of this GPathResult as aGPathResult. Warning: The subclasses of this package do not implement this method yet.- Returns:
- the parents of this GPathResult
-
childNodes
Deprecated.Returns an iterator over the child nodes of this GPathResult.- Returns:
- an iterator over the child nodes of this GPathResult
-
iterator
Deprecated. -
find
Deprecated.Returns the first child of this GPathResult matching the condition(s) specified in the passed closure.- Parameters:
closure- a closure to filters the children of this GPathResult- Returns:
- the first child matching the closure
-
findAll
Deprecated.Returns the children of this GPathResult matching the condition(s) specified in the passed closure.- Parameters:
closure- a closure to filters the children of this GPathResult- Returns:
- the children matching the closure
-
nodeIterator
Deprecated. -
createIterator
Deprecated.
-