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 Summary

    Fields
    Modifier and Type Field Description
    protected java.lang.String name
    Deprecated.
     
    protected java.util.Map namespaceMap
    Deprecated.
     
    protected java.lang.String namespacePrefix
    Deprecated.
     
    protected java.util.Map<java.lang.String,​java.lang.String> namespaceTagHints
    Deprecated.
     
    protected GPathResult parent
    Deprecated.
     
  • Constructor Summary

    Constructors
    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 named name with the parent parent, the namespacePrefix namespacePrefix and the namespaceTagHints specified in the namespaceTagHints Map.
  • Method Summary

    Modifier and Type Method Description
    protected abstract void appendNode​(java.lang.Object newValue)
    Deprecated.
     
    java.util.Iterator breadthFirst()
    Deprecated.
    Provides an Iterator over all the nodes of this GPathResult using a breadth-first traversal.
    abstract java.util.Iterator childNodes()
    Deprecated.
    Returns an iterator over the child nodes of this GPathResult.
    GPathResult children()
    Deprecated.
    Returns the children of this GPathResult as a GPathResult object.
    protected java.util.Iterator createIterator​(java.lang.Object obj)
    Deprecated.
     
    GPathResult declareNamespace​(java.util.Map newNamespaceMapping)
    Deprecated.
    Adds the specified map of prefix to namespace mappings to this GPathResult.
    java.util.Iterator depthFirst()
    Deprecated.
    Provides an Iterator over all the nodes of this GPathResult using a depth-first traversal.
    boolean equals​(java.lang.Object obj)
    Deprecated.
     
    abstract GPathResult find​(Closure closure)
    Deprecated.
    Returns the first child of this GPathResult matching the condition(s) specified in the passed closure.
    abstract GPathResult findAll​(Closure closure)
    Deprecated.
    Returns the children of this GPathResult matching the condition(s) specified in the passed closure.
    java.lang.Object getAt​(int index)
    Deprecated.
    Supports the subscript operator for a GPathResult.
    java.lang.Object getAt​(IntRange range)
    Deprecated.
    Supports the range subscript operator for a GPathResult.
    Closure getBody()
    Deprecated.
    Creates a Closure representing the body of this GPathResult.
    java.lang.Object getProperty​(java.lang.String property)
    Deprecated.
    Returns the specified Property of this GPathResult.
    int hashCode()
    Deprecated.
     
    boolean isEmpty()
    Deprecated.
    Returns true if the GPathResult is empty, i.e.
    abstract java.util.Iterator iterator()
    Deprecated.
     
    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.
    java.util.List list()
    Deprecated.
    Creates a list of objects representing this GPathResult.
    java.lang.String lookupNamespace​(java.lang.String prefix)
    Deprecated.
    Returns the namespace mapped to the specified prefix.
    java.lang.String name()
    Deprecated.
    Returns the name of this GPathResult.
    abstract java.util.Iterator nodeIterator()
    Deprecated.
     
    GPathResult parent()
    Deprecated.
    Returns as GPathResult with the parent nodes of the current GPathResult
    abstract GPathResult parents()
    Deprecated.
    Returns the parents of this GPathResult as a GPathResult.
    java.lang.Object plus​(java.lang.Object newValue)
    Deprecated.
    Lazily adds the specified Object to this GPathResult.
    GPathResult pop()
    Deprecated.
    Returns the parent of this GPathResult.
    void putAt​(int index, java.lang.Object newValue)
    Deprecated.
    A helper method to allow GPathResults to work with subscript operators
    protected abstract void replaceBody​(java.lang.Object newValue)
    Deprecated.
     
    protected abstract void replaceNode​(Closure newValue)
    Deprecated.
     
    void setMetaClass​(MetaClass metaClass)
    Deprecated.
    Replaces the MetaClass of this GPathResult.
    void setProperty​(java.lang.String property, java.lang.Object newValue)
    Deprecated.
    Replaces the specified property of this GPathResult with a new value.
    abstract int size()
    Deprecated.
    Returns the size of this GPathResult.
    abstract java.lang.String text()
    Deprecated.
    Returns the text of this GPathResult as a String.
    java.math.BigDecimal toBigDecimal()
    Deprecated.
    Converts the text of this GPathResult to a BigDecimal object.
    java.math.BigInteger toBigInteger()
    Deprecated.
    Converts the text of this GPathResult to a BigInteger object.
    java.lang.Boolean toBoolean()
    Deprecated.
    Converts the text of this GPathResult to a Boolean object.
    java.lang.Double toDouble()
    Deprecated.
    Converts the text of this GPathResult to a Double object.
    java.lang.Float toFloat()
    Deprecated.
    Converts the text of this GPathResult to a Float object.
    java.lang.Integer toInteger()
    Deprecated.
    Converts the text of this GPathResult to a Integer object.
    java.lang.Long toLong()
    Deprecated.
    Converts the text of this GPathResult to a Long object.
    java.lang.String toString()
    Deprecated.
    Returns the text of this GPathResult.
    java.net.URI toURI()
    Deprecated.
    Converts the text of this GPathResult to a URI object.
    java.net.URL toURL()
    Deprecated.
    Converts the text of this GPathResult to a URL object.

    Methods inherited from class groovy.lang.GroovyObjectSupport

    getMetaClass

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface groovy.lang.Buildable

    build

    Methods inherited from interface groovy.lang.GroovyObject

    invokeMethod

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface groovy.lang.Writable

    writeTo
  • Field Details

    • parent

      protected final GPathResult parent
      Deprecated.
    • name

      protected final java.lang.String name
      Deprecated.
    • namespacePrefix

      protected final java.lang.String namespacePrefix
      Deprecated.
    • namespaceMap

      protected final java.util.Map namespaceMap
      Deprecated.
    • namespaceTagHints

      protected final java.util.Map<java.lang.String,​java.lang.String> namespaceTagHints
      Deprecated.
  • Constructor Details

    • GPathResult

      public 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 named name with the parent parent, the namespacePrefix namespacePrefix and the namespaceTagHints specified in the namespaceTagHints Map.
      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

    • setMetaClass

      public void setMetaClass​(MetaClass metaClass)
      Deprecated.
      Replaces the MetaClass of this GPathResult.
      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)
      Deprecated.
      Returns the specified Property of this GPathResult.

      Realizes the follow shortcuts:

      • '..' for parent()
      • '*' for children()
      • '**' for depthFirst()
      • '@' for attribute access
      Specified by:
      getProperty in interface GroovyObject
      Parameters:
      property - the Property to fetch
      Returns:
      the given property
    • setProperty

      public void setProperty​(java.lang.String property, java.lang.Object newValue)
      Deprecated.
      Replaces the specified property of this GPathResult with a new value.
      Specified by:
      setProperty in interface GroovyObject
      Parameters:
      property - the property of this GPathResult to replace
      newValue - the new value of the property
    • leftShift

      public 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
    • plus

      public 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
    • replaceNode

      protected abstract void replaceNode​(Closure newValue)
      Deprecated.
    • replaceBody

      protected abstract void replaceBody​(java.lang.Object newValue)
      Deprecated.
    • appendNode

      protected abstract void appendNode​(java.lang.Object newValue)
      Deprecated.
    • name

      public java.lang.String name()
      Deprecated.
      Returns the name of this GPathResult.
      Returns:
      the name of this GPathResult
    • pop

      public 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

      public GPathResult parent()
      Deprecated.
      Returns as GPathResult with the parent nodes of the current GPathResult
      Returns:
      the parents GPathResult or this for the root
    • children

      public GPathResult children()
      Deprecated.
      Returns the children of this GPathResult as a GPathResult object.
      Returns:
      the children of this GPathResult
    • lookupNamespace

      public 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
    • toString

      public java.lang.String toString()
      Deprecated.
      Returns the text of this GPathResult.
      Overrides:
      toString in class java.lang.Object
      Returns:
      the GPathResult, converted to a String
    • toInteger

      public java.lang.Integer toInteger()
      Deprecated.
      Converts the text of this GPathResult to a Integer object.
      Returns:
      the GPathResult, converted to a Integer
    • toLong

      public java.lang.Long toLong()
      Deprecated.
      Converts the text of this GPathResult to a Long object.
      Returns:
      the GPathResult, converted to a Long
    • toFloat

      public java.lang.Float toFloat()
      Deprecated.
      Converts the text of this GPathResult to a Float object.
      Returns:
      the GPathResult, converted to a Float
    • toDouble

      public java.lang.Double toDouble()
      Deprecated.
      Converts the text of this GPathResult to a Double object.
      Returns:
      the GPathResult, converted to a Double
    • toBigDecimal

      public java.math.BigDecimal toBigDecimal()
      Deprecated.
      Converts the text of this GPathResult to a BigDecimal object.
      Returns:
      the GPathResult, converted to a BigDecimal
    • toBigInteger

      public java.math.BigInteger toBigInteger()
      Deprecated.
      Converts the text of this GPathResult to a BigInteger object.
      Returns:
      the GPathResult, converted to a BigInteger
    • toURL

      public java.net.URL toURL() throws java.net.MalformedURLException
      Deprecated.
      Converts the text of this GPathResult to a URL object.
      Returns:
      the GPathResult, converted to a URL
      Throws:
      java.net.MalformedURLException
    • toURI

      public java.net.URI toURI() throws java.net.URISyntaxException
      Deprecated.
      Converts the text of this GPathResult to a URI object.
      Returns:
      the GPathResult, converted to a URI
      Throws:
      java.net.URISyntaxException
    • toBoolean

      public java.lang.Boolean toBoolean()
      Deprecated.
      Converts the text of this GPathResult to a Boolean object.
      Returns:
      the GPathResult, converted to a Boolean
    • declareNamespace

      public GPathResult declareNamespace​(java.util.Map newNamespaceMapping)
      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.
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Deprecated.
      Overrides:
      equals in class java.lang.Object
    • getAt

      public 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
    • getAt

      public java.lang.Object getAt​(IntRange range)
      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

      public 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
    • depthFirst

      public java.util.Iterator depthFirst()
      Deprecated.
      Provides an Iterator over all the nodes of this GPathResult using a depth-first traversal.
      Returns:
      the Iterator of (depth-first) ordered GPathResults
    • breadthFirst

      public java.util.Iterator breadthFirst()
      Deprecated.
      Provides an Iterator over all the nodes of this GPathResult using a breadth-first traversal.
      Returns:
      the Iterator of (breadth-first) ordered GPathResults
    • list

      public java.util.List 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 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

      public abstract java.lang.String text()
      Deprecated.
      Returns the text of this GPathResult as a String.
      Returns:
      the text of this GPathResult
    • parents

      public abstract GPathResult parents()
      Deprecated.
      Returns the parents of this GPathResult as a GPathResult. Warning: The subclasses of this package do not implement this method yet.
      Returns:
      the parents of this GPathResult
    • childNodes

      public 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
    • iterator

      public abstract java.util.Iterator iterator()
      Deprecated.
      Specified by:
      iterator in interface java.lang.Iterable
    • find

      public abstract GPathResult find​(Closure closure)
      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

      public abstract GPathResult findAll​(Closure closure)
      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

      public abstract java.util.Iterator nodeIterator()
      Deprecated.
    • createIterator

      protected java.util.Iterator createIterator​(java.lang.Object obj)
      Deprecated.