Package groovy.util.slurpersupport
Class GPathResult
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.slurpersupport.GPathResult
- All Implemented Interfaces:
- Buildable,- GroovyObject,- Writable,- java.lang.Iterable
- Direct Known Subclasses:
- Attribute,- NoChildren,- NodeChild,- NodeChildren
@Deprecated public abstract class GPathResult extends GroovyObjectSupport implements Writable, Buildable, java.lang.Iterable
Deprecated.
Base class for representing lazy evaluated GPath expressions.
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringnameDeprecated.protected java.util.MapnamespaceMapDeprecated.protected java.lang.StringnamespacePrefixDeprecated.protected java.util.Map<java.lang.String,java.lang.String>namespaceTagHintsDeprecated.protected GPathResultparentDeprecated.
- 
Constructor SummaryConstructors Constructor Description GPathResult(GPathResult parent, java.lang.String name, java.lang.String namespacePrefix, java.util.Map<java.lang.String,java.lang.String> namespaceTagHints)Deprecated.Creates a new GPathResult namednamewith the parentparent, the namespacePrefixnamespacePrefixand the namespaceTagHints specified in thenamespaceTagHintsMap.
- 
Method SummaryModifier and Type Method Description protected abstract voidappendNode(java.lang.Object newValue)Deprecated.java.util.IteratorbreadthFirst()Deprecated.Provides an Iterator over all the nodes of this GPathResult using a breadth-first traversal.abstract java.util.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 java.util.IteratorcreateIterator(java.lang.Object obj)Deprecated.GPathResultdeclareNamespace(java.util.Map newNamespaceMapping)Deprecated.Adds the specified map of prefix to namespace mappings to this GPathResult.java.util.IteratordepthFirst()Deprecated.Provides an Iterator over all the nodes of this GPathResult using a depth-first traversal.booleanequals(java.lang.Object obj)Deprecated.abstract GPathResultfind(Closure closure)Deprecated.Returns the first child of this GPathResult matching the condition(s) specified in the passed closure.abstract GPathResultfindAll(Closure closure)Deprecated.Returns the children of this GPathResult matching the condition(s) specified in the passed closure.java.lang.ObjectgetAt(int index)Deprecated.Supports the subscript operator for a GPathResult.java.lang.ObjectgetAt(IntRange range)Deprecated.Supports the range subscript operator for a GPathResult.ClosuregetBody()Deprecated.Creates a Closure representing the body of this GPathResult.java.lang.ObjectgetProperty(java.lang.String property)Deprecated.Returns the specified Property of this GPathResult.inthashCode()Deprecated.booleanisEmpty()Deprecated.Returns true if the GPathResult is empty, i.e.abstract java.util.Iteratoriterator()Deprecated.java.lang.ObjectleftShift(java.lang.Object newValue)Deprecated.Overloads the left shift operator to provide an easy way to lazily append Objects to this GPathResult.java.util.Listlist()Deprecated.Creates a list of objects representing this GPathResult.java.lang.StringlookupNamespace(java.lang.String prefix)Deprecated.Returns the namespace mapped to the specified prefix.java.lang.Stringname()Deprecated.Returns the name of this GPathResult.abstract java.util.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.java.lang.Objectplus(java.lang.Object newValue)Deprecated.Lazily adds the specified Object to this GPathResult.GPathResultpop()Deprecated.Returns the parent of this GPathResult.voidputAt(int index, java.lang.Object newValue)Deprecated.A helper method to allow GPathResults to work with subscript operatorsprotected abstract voidreplaceBody(java.lang.Object newValue)Deprecated.protected abstract voidreplaceNode(Closure newValue)Deprecated.voidsetMetaClass(MetaClass metaClass)Deprecated.Replaces the MetaClass of this GPathResult.voidsetProperty(java.lang.String property, java.lang.Object newValue)Deprecated.Replaces the specified property of this GPathResult with a new value.abstract intsize()Deprecated.Returns the size of this GPathResult.abstract java.lang.Stringtext()Deprecated.Returns the text of this GPathResult as aString.java.math.BigDecimaltoBigDecimal()Deprecated.Converts the text of this GPathResult to a BigDecimal object.java.math.BigIntegertoBigInteger()Deprecated.Converts the text of this GPathResult to a BigInteger object.java.lang.BooleantoBoolean()Deprecated.Converts the text of this GPathResult to a Boolean object.java.lang.DoubletoDouble()Deprecated.Converts the text of this GPathResult to a Double object.java.lang.FloattoFloat()Deprecated.Converts the text of this GPathResult to a Float object.java.lang.IntegertoInteger()Deprecated.Converts the text of this GPathResult to a Integer object.java.lang.LongtoLong()Deprecated.Converts the text of this GPathResult to a Long object.java.lang.StringtoString()Deprecated.Returns the text of this GPathResult.java.net.URItoURI()Deprecated.Converts the text of this GPathResult to a URI object.java.net.URLtoURL()Deprecated.Converts the text of this GPathResult to a URL object.Methods inherited from class groovy.lang.GroovyObjectSupportgetMetaClassMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObjectinvokeMethodMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Field Details- 
parentDeprecated.
- 
nameprotected final java.lang.String nameDeprecated.
- 
namespacePrefixprotected final java.lang.String namespacePrefixDeprecated.
- 
namespaceMapprotected final java.util.Map namespaceMapDeprecated.
- 
namespaceTagHintsprotected final java.util.Map<java.lang.String,java.lang.String> namespaceTagHintsDeprecated.
 
- 
- 
Constructor Details- 
GPathResultpublic GPathResult(GPathResult parent, java.lang.String name, java.lang.String namespacePrefix, java.util.Map<java.lang.String,java.lang.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 GPathResult
- name- if the GPathResult corresponds to something with a name, e.g. a node
- namespacePrefix- the namespace prefix if any
- namespaceTagHints- the known tag to namespace mappings
 
 
- 
- 
Method Details- 
setMetaClassDeprecated.Replaces the MetaClass of this GPathResult.- Specified by:
- setMetaClassin interface- GroovyObject
- Overrides:
- setMetaClassin class- GroovyObjectSupport
- Parameters:
- metaClass- the new MetaClass
 
- 
getPropertypublic java.lang.Object getProperty(java.lang.String property)Deprecated.Returns the specified Property of this GPathResult.Realizes the follow shortcuts: - '..'for- parent()
- '*'for- children()
- '**'for- depthFirst()
- '@'for attribute access
 - Specified by:
- getPropertyin interface- GroovyObject
- Parameters:
- property- the Property to fetch
- Returns:
- the given property
 
- 
setPropertypublic void setProperty(java.lang.String property, java.lang.Object newValue)Deprecated.Replaces the specified property of this GPathResult with a new value.- Specified by:
- setPropertyin interface- GroovyObject
- Parameters:
- property- the property of this GPathResult to replace
- newValue- the new value of the property
 
- 
leftShiftpublic java.lang.Object leftShift(java.lang.Object newValue)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
 
- 
pluspublic java.lang.Object plus(java.lang.Object newValue)Deprecated.Lazily adds the specified Object to this GPathResult.- Parameters:
- newValue- the Object to add
- Returns:
- this
 
- 
replaceNodeDeprecated.
- 
replaceBodyprotected abstract void replaceBody(java.lang.Object newValue)Deprecated.
- 
appendNodeprotected abstract void appendNode(java.lang.Object newValue)Deprecated.
- 
namepublic java.lang.String name()Deprecated.Returns the name of this GPathResult.- Returns:
- the name of this GPathResult
 
- 
popDeprecated.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
 
- 
parentDeprecated.Returns as GPathResult with the parent nodes of the current GPathResult- Returns:
- the parents GPathResult or thisfor the root
 
- 
childrenDeprecated.Returns the children of this GPathResult as a GPathResult object.- Returns:
- the children of this GPathResult
 
- 
lookupNamespacepublic java.lang.String lookupNamespace(java.lang.String prefix)Deprecated.Returns the namespace mapped to the specified prefix.- Parameters:
- prefix- the prefix lookup
- Returns:
- the namespace of the prefix
 
- 
toStringpublic java.lang.String toString()Deprecated.Returns the text of this GPathResult.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- the GPathResult, converted to a String
 
- 
toIntegerpublic java.lang.Integer toInteger()Deprecated.Converts the text of this GPathResult to a Integer object.- Returns:
- the GPathResult, converted to a Integer
 
- 
toLongpublic java.lang.Long toLong()Deprecated.Converts the text of this GPathResult to a Long object.- Returns:
- the GPathResult, converted to a Long
 
- 
toFloatpublic java.lang.Float toFloat()Deprecated.Converts the text of this GPathResult to a Float object.- Returns:
- the GPathResult, converted to a Float
 
- 
toDoublepublic java.lang.Double toDouble()Deprecated.Converts the text of this GPathResult to a Double object.- Returns:
- the GPathResult, converted to a Double
 
- 
toBigDecimalpublic java.math.BigDecimal toBigDecimal()Deprecated.Converts the text of this GPathResult to a BigDecimal object.- Returns:
- the GPathResult, converted to a BigDecimal
 
- 
toBigIntegerpublic java.math.BigInteger toBigInteger()Deprecated.Converts the text of this GPathResult to a BigInteger object.- Returns:
- the GPathResult, converted to a BigInteger
 
- 
toURLpublic java.net.URL toURL() throws java.net.MalformedURLExceptionDeprecated.Converts the text of this GPathResult to a URL object.- Returns:
- the GPathResult, converted to a URL
- Throws:
- java.net.MalformedURLException
 
- 
toURIpublic java.net.URI toURI() throws java.net.URISyntaxExceptionDeprecated.Converts the text of this GPathResult to a URI object.- Returns:
- the GPathResult, converted to a URI
- Throws:
- java.net.URISyntaxException
 
- 
toBooleanpublic java.lang.Boolean toBoolean()Deprecated.Converts the text of this GPathResult to a Boolean object.- Returns:
- the GPathResult, converted to a Boolean
 
- 
declareNamespaceDeprecated.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
 
- 
hashCodepublic int hashCode()Deprecated.- Overrides:
- hashCodein class- java.lang.Object
 
- 
equalspublic boolean equals(java.lang.Object obj)Deprecated.- Overrides:
- equalsin class- java.lang.Object
 
- 
getAtpublic java.lang.Object getAt(int index)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
 
- 
getAtDeprecated.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
 
- 
putAtpublic void putAt(int index, java.lang.Object newValue)Deprecated.A helper method to allow GPathResults to work with subscript operators- Parameters:
- index- an index
- newValue- the value to put at the given index
 
- 
depthFirstpublic java.util.Iterator depthFirst()Deprecated.Provides an Iterator over all the nodes of this GPathResult using a depth-first traversal.- Returns:
- the Iteratorof (depth-first) ordered GPathResults
 
- 
breadthFirstpublic java.util.Iterator breadthFirst()Deprecated.Provides an Iterator over all the nodes of this GPathResult using a breadth-first traversal.- Returns:
- the Iteratorof (breadth-first) ordered GPathResults
 
- 
listpublic java.util.List list()Deprecated.Creates a list of objects representing this GPathResult.- Returns:
- a list representing of this GPathResult
 
- 
isEmptypublic 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
 
- 
getBodyDeprecated.Creates a Closure representing the body of this GPathResult.- Returns:
- the body of this GPathResult, converted to a Closure
 
- 
sizepublic abstract int size()Deprecated.Returns the size of this GPathResult.- Returns:
- the size of this GPathResult
 
- 
textpublic abstract java.lang.String text()Deprecated.Returns the text of this GPathResult as aString.- Returns:
- the text of this GPathResult
 
- 
parentsDeprecated.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
 
- 
childNodespublic abstract java.util.Iterator childNodes()Deprecated.Returns an iterator over the child nodes of this GPathResult.- Returns:
- an iterator over the child nodes of this GPathResult
 
- 
iteratorpublic abstract java.util.Iterator iterator()Deprecated.- Specified by:
- iteratorin interface- java.lang.Iterable
 
- 
findDeprecated.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
 
- 
findAllDeprecated.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
 
- 
nodeIteratorpublic abstract java.util.Iterator nodeIterator()Deprecated.
- 
createIteratorprotected java.util.Iterator createIterator(java.lang.Object obj)Deprecated.
 
-