Groovy Documentation

groovy.util.slurpersupport
[Java] Class Attribute

java.lang.Object
  groovy.lang.GroovyObjectSupport
      groovy.util.slurpersupport.GPathResult
          groovy.util.slurpersupport.Attribute

public class Attribute
extends GPathResult

Lazy evaluated representation of a node attribute.

Authors:
John Wilson


Field Summary
 
Fields inherited from class GPathResult
name, namespaceMap, namespacePrefix, namespaceTagHints, parent
 
Constructor Summary
Attribute(java.lang.String name, java.lang.String value, GPathResult parent, java.lang.String namespacePrefix, java.util.Map namespaceTagHints)

@param name of the attribute

 
Method Summary
protected void appendNode(java.lang.Object newValue)

NOP, because an node can not be appended to an attribute.

void build(GroovyObject builder)

java.util.Iterator childNodes()

Throws a GroovyRuntimeException, because an attribute can have no children.

GPathResult find(Closure closure)

GPathResult findAll(Closure closure)

java.util.Iterator iterator()

java.lang.String name()

java.lang.String namespaceURI()

Returns the URI of the namespace of this Attribute.

java.util.Iterator nodeIterator()

GPathResult parents()

Throws a GroovyRuntimeException, because this method is not implemented yet.

protected void replaceBody(java.lang.Object newValue)

NOP, because an attribute does not have a Body.

protected void replaceNode(Closure newValue)

NOP, because an attribute does not have any Node to replace.

int size()

Returns the size of this Attribute, which is always 1.

java.lang.String text()

Returns the value of this Attribute.

java.io.Writer writeTo(java.io.Writer out)

 
Methods inherited from class GPathResult
appendNode, breadthFirst, childNodes, children, declareNamespace, depthFirst, equals, find, findAll, getAt, getAt, getBody, getProperty, isEmpty, iterator, leftShift, list, lookupNamespace, name, nodeIterator, parent, parents, plus, putAt, replaceBody, replaceNode, setMetaClass, setProperty, size, text, toBigDecimal, toBigInteger, toBoolean, toDouble, toFloat, toInteger, toLong, toString, toURI, toURL
 
Methods inherited from class GroovyObjectSupport
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

Attribute

public Attribute(java.lang.String name, java.lang.String value, GPathResult parent, java.lang.String namespacePrefix, java.util.Map namespaceTagHints)
Parameters:
name - of the attribute
value - of the attribute
parent - the GPathResult prior to the application of the expression creating this GPathResult
namespacePrefix - the namespace prefix if any
namespaceTagHints - the known tag to namespace mappings


 
Method Detail

appendNode

protected void appendNode(java.lang.Object newValue)
NOP, because an node can not be appended to an attribute.


build

public void build(GroovyObject builder)


childNodes

public java.util.Iterator childNodes()
Throws a GroovyRuntimeException, because an attribute can have no children.


find

public GPathResult find(Closure closure)


findAll

public GPathResult findAll(Closure closure)


iterator

public java.util.Iterator iterator()


name

public java.lang.String name()


namespaceURI

public java.lang.String namespaceURI()
Returns the URI of the namespace of this Attribute.
Returns:
the namespace of this Attribute


nodeIterator

public java.util.Iterator nodeIterator()


parents

public GPathResult parents()
Throws a GroovyRuntimeException, because this method is not implemented yet.


replaceBody

protected void replaceBody(java.lang.Object newValue)
NOP, because an attribute does not have a Body.


replaceNode

protected void replaceNode(Closure newValue)
NOP, because an attribute does not have any Node to replace.


size

public int size()
Returns the size of this Attribute, which is always 1.
Returns:
1


text

public java.lang.String text()
Returns the value of this Attribute.
Returns:
the value of this Attribute


writeTo

public java.io.Writer writeTo(java.io.Writer out)


 

Groovy Documentation