Class 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.
    • 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 GPathResult
        name - if the GPathResult corresponds to something with a name, e.g. a node
        namespaceTagHints - the known tag to namespace mappings
    • Method Detail

      • size

        public int size()
        Returns 0.
        Specified by:
        size in class GPathResult
        Returns:
        0
      • text

        public String text()
        Returns an empty String.
        Specified by:
        text in class GPathResult
        Returns:
        an empty String
      • parents

        public GPathResult parents()
        Throws a GroovyRuntimeException, because it is not implemented yet.
        Specified by:
        parents in class GPathResult
        Returns:
        the parents of this GPathResult
      • childNodes

        public Iterator childNodes()
        Returns an empty Iterator.
        Specified by:
        childNodes in class GPathResult
        Returns:
        an empty Iterator
      • find

        public GPathResult find​(Closure closure)
        Returns this.
        Specified by:
        find in class GPathResult
        Parameters:
        closure - a closure to filters the children of this GPathResult
        Returns:
        this
      • findAll

        public GPathResult findAll​(Closure closure)
        Returns this.
        Specified by:
        findAll in class GPathResult
        Parameters:
        closure - a closure to filters the children of this GPathResult
        Returns:
        this
      • 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
      • asBoolean

        public boolean asBoolean()
        Returns false.
        Returns:
        false