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.

Author:
  John Wilson

### Field Summary

Fields
`protected String` `name`
`protected Map` `namespaceMap`
`protected String` `namespacePrefix`
`protected Map<String,String>` `namespaceTagHints`
`protected GPathResult` `parent`

### Constructor Summary

Constructors
Constructor and Description
`GPathResult(GPathResult parent, String name, String namespacePrefix, Map<String,String> namespaceTagHints)`

### Method Summary

Methods
`protected abstract void` `appendNode(Object newValue)`
`Iterator` `breadthFirst()` An iterator useful for traversing XML documents/fragments in breadth-first order.
`abstract Iterator` `childNodes()`
`GPathResult` `children()`
`GPathResult` `declareNamespace(Map newNamespaceMapping)`
`Iterator` `depthFirst()`
`boolean` `equals(Object obj)`
`abstract GPathResult` `find(Closure closure)`
`abstract GPathResult` `findAll(Closure closure)`
`Object` `getAt(int index)`
`Object` `getAt(IntRange range)`
`Closure` `getBody()`
`Object` `getProperty(String property)` Retrieves a property value.
`boolean` `isEmpty()`
`abstract Iterator` `iterator()`
`Object` `leftShift(Object newValue)`
`List` `list()`
`String` `lookupNamespace(String prefix)`
`String` `name()`
`abstract Iterator` `nodeIterator()`
`GPathResult` `parent()`
`abstract GPathResult` `parents()`
`Object` `plus(Object newValue)`
`void` `putAt(int index, Object newValue)`
`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()`
`BigDecimal` `toBigDecimal()`
`BigInteger` `toBigInteger()`
`Boolean` `toBoolean()`
`Double` `toDouble()`
`Float` `toFloat()`
`Integer` `toInteger()`
`Long` `toLong()`
`String` `toString()`
`URI` `toURI()`
`URL` `toURL()`

### Methods inherited from class groovy.lang.GroovyObjectSupport

`getMetaClass, invokeMethod`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface groovy.lang.Writable

`writeTo`

### Methods inherited from interface groovy.lang.Buildable

`build`

### Field Detail

#### parent

    protected final GPathResult parent

#### name

    protected final String name

#### namespacePrefix

    protected final String namespacePrefix

#### namespaceMap

    protected final Map namespaceMap

#### namespaceTagHints

    protected final Map<String,String> namespaceTagHints

### Constructor Detail

#### 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 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 Detail

#### 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 Object getProperty(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(String property,
                   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 interest
  `newValue` - the new value for the property

#### leftShift

    public Object leftShift(Object newValue)

#### plus

    public Object plus(Object newValue)

#### replaceNode

    protected abstract void replaceNode(Closure newValue)

#### replaceBody

    protected abstract void replaceBody(Object newValue)

#### appendNode

    protected abstract void appendNode(Object newValue)

#### name

    public String name()

#### parent

    public GPathResult parent()

#### children

    public GPathResult children()

#### lookupNamespace

    public String lookupNamespace(String prefix)

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### toInteger

    public Integer toInteger()

#### toLong

    public Long toLong()

#### toFloat

    public Float toFloat()

#### toDouble

    public Double toDouble()

#### toBigDecimal

    public BigDecimal toBigDecimal()

#### toBigInteger

    public BigInteger toBigInteger()

#### toURL

    public URL toURL()
              throws MalformedURLException

Throws:
  `MalformedURLException`

#### toURI

    public URI toURI()
              throws URISyntaxException

Throws:
  `URISyntaxException`

#### toBoolean

    public Boolean toBoolean()

#### declareNamespace

    public GPathResult declareNamespace(Map newNamespaceMapping)

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### getAt

    public Object getAt(int index)

#### getAt

    public Object getAt(IntRange range)

#### putAt

    public void putAt(int index,
             Object newValue)

#### depthFirst

    public Iterator depthFirst()

#### breadthFirst

    public Iterator breadthFirst()

An iterator useful for traversing XML documents/fragments in breadth-first order.

Returns:
  Iterator the iterator of GPathResult objects

#### list

    public List list()

#### isEmpty

    public boolean isEmpty()

#### getBody

    public Closure getBody()

#### size

    public abstract int size()

#### text

    public abstract String text()

#### parents

    public abstract GPathResult parents()

#### childNodes

    public abstract Iterator childNodes()

#### iterator

    public abstract Iterator iterator()

#### find

    public abstract GPathResult find(Closure closure)

#### findAll

    public abstract GPathResult findAll(Closure closure)

#### nodeIterator

    public abstract Iterator nodeIterator()