groovy.util
Class BuilderSupport

java.lang.Object
  extended bygroovy.lang.GroovyObjectSupport
      extended bygroovy.util.BuilderSupport
All Implemented Interfaces:
GroovyObject
Direct Known Subclasses:
AntBuilder, DOMBuilder, MarkupBuilder, Namespace, NodeBuilder, SAXBuilder, SwingBuilder

public abstract class BuilderSupport
extends GroovyObjectSupport

An abstract base class for creating arbitrary nested trees of objects or events

Version:
$Revision: 1.8 $
Author:
James Strachan

Field Summary
private  java.lang.Object current
           
private  Closure nameMappingClosure
           
private  BuilderSupport proxyBuilder
           
 
Fields inherited from class groovy.lang.GroovyObjectSupport
 
Constructor Summary
BuilderSupport()
           
BuilderSupport(BuilderSupport proxyBuilder)
           
BuilderSupport(Closure nameMappingClosure, BuilderSupport proxyBuilder)
           
 
Method Summary
protected abstract  java.lang.Object createNode(java.lang.Object name)
           
protected abstract  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)
           
protected abstract  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
           
protected abstract  java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
           
protected  java.lang.Object doInvokeMethod(java.lang.String methodName, java.lang.Object name, java.lang.Object args)
           
protected  java.lang.Object getCurrent()
           
protected  java.lang.Object getName(java.lang.String methodName)
          A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX
 java.lang.Object invokeMethod(java.lang.String methodName, java.lang.Object args)
          Invokes the given method
protected  void nodeCompleted(java.lang.Object parent, java.lang.Object node)
          A hook to allow nodes to be processed once they have had all of their children applied
protected  void setClosureDelegate(Closure closure, java.lang.Object node)
          A strategy method to allow derived builders to use builder-trees and switch in different kinds of builders.
protected  void setCurrent(java.lang.Object current)
           
protected abstract  void setParent(java.lang.Object parent, java.lang.Object child)
           
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current

private java.lang.Object current

nameMappingClosure

private Closure nameMappingClosure

proxyBuilder

private BuilderSupport proxyBuilder
Constructor Detail

BuilderSupport

public BuilderSupport()

BuilderSupport

public BuilderSupport(BuilderSupport proxyBuilder)

BuilderSupport

public BuilderSupport(Closure nameMappingClosure,
                      BuilderSupport proxyBuilder)
Method Detail

invokeMethod

public java.lang.Object invokeMethod(java.lang.String methodName,
                                     java.lang.Object args)
Description copied from interface: GroovyObject
Invokes the given method

Specified by:
invokeMethod in interface GroovyObject
Overrides:
invokeMethod in class GroovyObjectSupport

doInvokeMethod

protected java.lang.Object doInvokeMethod(java.lang.String methodName,
                                          java.lang.Object name,
                                          java.lang.Object args)

setClosureDelegate

protected void setClosureDelegate(Closure closure,
                                  java.lang.Object node)
A strategy method to allow derived builders to use builder-trees and switch in different kinds of builders. This method should call the setDelegate() method on the closure which by default passes in this but if node is-a builder we could pass that in instead (or do something wacky too)

Parameters:
closure - the closure on which to call setDelegate()
node - the node value that we've just created, which could be a builder

setParent

protected abstract void setParent(java.lang.Object parent,
                                  java.lang.Object child)

createNode

protected abstract java.lang.Object createNode(java.lang.Object name)

createNode

protected abstract java.lang.Object createNode(java.lang.Object name,
                                               java.lang.Object value)

createNode

protected abstract java.lang.Object createNode(java.lang.Object name,
                                               java.util.Map attributes)

createNode

protected abstract java.lang.Object createNode(java.lang.Object name,
                                               java.util.Map attributes,
                                               java.lang.Object value)

getName

protected java.lang.Object getName(java.lang.String methodName)
A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX

Parameters:
methodName -
Returns:

nodeCompleted

protected void nodeCompleted(java.lang.Object parent,
                             java.lang.Object node)
A hook to allow nodes to be processed once they have had all of their children applied


getCurrent

protected java.lang.Object getCurrent()

setCurrent

protected void setCurrent(java.lang.Object current)


Copyright © 2003-2005 The Codehaus. All Rights Reserved.