Package groovy.util.slurpersupport
Class NoChildren
- java.lang.Object
-
- groovy.lang.GroovyObjectSupport
-
- groovy.util.slurpersupport.GPathResult
-
- groovy.util.slurpersupport.NoChildren
-
- All Implemented Interfaces:
Buildable
,GroovyObject
,Writable
,Iterable
public class NoChildren extends GPathResult
Lazy evaluated representation of a GPath expression returning no children. As this class represents a GPath expression with no results, all methods are either NOPs or return an empty result.
-
-
Field Summary
-
Fields inherited from class groovy.util.slurpersupport.GPathResult
name, namespaceMap, namespacePrefix, namespaceTagHints, parent
-
-
Constructor Summary
Constructors Constructor Description NoChildren(GPathResult parent, String name, Map<String,String> namespaceTagHints)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendNode(Object newValue)
NOPboolean
asBoolean()
Returnsfalse
.void
build(GroovyObject builder)
NOPIterator
childNodes()
Returns an emptyIterator
.GPathResult
find(Closure closure)
Returnsthis
.GPathResult
findAll(Closure closure)
Returnsthis
.Iterator
iterator()
Returns an emptyIterator
.Iterator
nodeIterator()
Returns an empty iterator.GPathResult
parents()
Throws aGroovyRuntimeException
, because it is not implemented yet.protected void
replaceBody(Object newValue)
NOPprotected void
replaceNode(Closure newValue)
NOPint
size()
Returns0
.String
text()
Returns an emptyString
.Writer
writeTo(Writer out)
Does not write any output, just returns the writer.-
Methods inherited from class groovy.util.slurpersupport.GPathResult
breadthFirst, children, createIterator, declareNamespace, depthFirst, equals, getAt, getAt, getBody, getProperty, hashCode, isEmpty, leftShift, list, lookupNamespace, name, parent, plus, pop, putAt, setMetaClass, setProperty, toBigDecimal, toBigInteger, toBoolean, toDouble, toFloat, toInteger, toLong, toString, toURI, toURL
-
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, invokeMethod
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
NoChildren
public NoChildren(GPathResult parent, String name, 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 nodenamespaceTagHints
- the known tag to namespace mappings
-
-
Method Detail
-
size
public int size()
Returns0
.- Specified by:
size
in classGPathResult
- Returns:
0
-
text
public String text()
Returns an emptyString
.- Specified by:
text
in classGPathResult
- Returns:
- an empty
String
-
parents
public GPathResult parents()
Throws aGroovyRuntimeException
, because it is not implemented yet.- Specified by:
parents
in classGPathResult
- Returns:
- the parents of this GPathResult
-
childNodes
public Iterator childNodes()
Returns an emptyIterator
.- Specified by:
childNodes
in classGPathResult
- Returns:
- an empty
Iterator
-
iterator
public Iterator iterator()
Returns an emptyIterator
.- Specified by:
iterator
in interfaceIterable
- Specified by:
iterator
in classGPathResult
- Returns:
- an empty
Iterator
-
find
public GPathResult find(Closure closure)
Returnsthis
.- Specified by:
find
in classGPathResult
- Parameters:
closure
- a closure to filters the children of this GPathResult- Returns:
this
-
findAll
public GPathResult findAll(Closure closure)
Returnsthis
.- Specified by:
findAll
in classGPathResult
- Parameters:
closure
- a closure to filters the children of this GPathResult- Returns:
this
-
nodeIterator
public Iterator nodeIterator()
Returns an empty iterator.- Specified by:
nodeIterator
in classGPathResult
- Returns:
- an empty iterator
-
writeTo
public Writer writeTo(Writer out) throws IOException
Does not write any output, just returns the writer.- Parameters:
out
- the Writer to which this Writable should output its data.- Returns:
- the
Writer
which was passed in - Throws:
IOException
- if an error occurred while outputting data to the writer
-
build
public void build(GroovyObject builder)
NOP
-
replaceNode
protected void replaceNode(Closure newValue)
NOP- Specified by:
replaceNode
in classGPathResult
-
replaceBody
protected void replaceBody(Object newValue)
NOP- Specified by:
replaceBody
in classGPathResult
-
appendNode
protected void appendNode(Object newValue)
NOP- Specified by:
appendNode
in classGPathResult
-
asBoolean
public boolean asBoolean()
Returnsfalse
.- Returns:
false
-
-