groovy.util
Class BuilderSupport

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

author:
James Strachan
version:
$Revision: 7922 $

Field Summary
 Object current
           
 Closure nameMappingClosure
           
 BuilderSupport proxyBuilder
           
 
Constructor Summary
BuilderSupport()
           
BuilderSupport(BuilderSupport proxyBuilder)
           
BuilderSupport(Closure nameMappingClosure, BuilderSupport proxyBuilder)
           
 
Method Summary
Object createNode(Object name)
          
Object createNode(Object name, Object value)
          
Object createNode(Object name, Map attributes)
          
Object createNode(Object name, Map attributes, Object value)
          
Object doInvokeMethod(String methodName, Object name, Object args)
          
Object getCurrent()
          
Object getName(String methodName)
           A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX.
Object invokeMethod(String methodName)
           Convenience method when no arguments are required
Object invokeMethod(String methodName, Object args)
          
void nodeCompleted(Object parent, Object node)
           A hook to allow nodes to be processed once they have had all of their children applied.
Object postNodeCompletion(Object parent, Object node)
           A hook to allow nodes to be processed once they have had all of their children applied and allows the actual node object that represents the Markup element to be changed
void setClosureDelegate(Closure closure, Object node)
           A strategy method to allow derived builders to use builder-trees and switch in different kinds of builders.
void setCurrent(Object current)
          
void setParent(Object parent, Object child)
          
 

Constructor Detail

BuilderSupport

public BuilderSupport()


BuilderSupport

public BuilderSupport(BuilderSupport proxyBuilder)


BuilderSupport

public BuilderSupport(Closure nameMappingClosure, BuilderSupport proxyBuilder)


Method Detail

createNode

Object createNode(Object name)


createNode

Object createNode(Object name, Object value)


createNode

Object createNode(Object name, Map attributes)


createNode

Object createNode(Object name, Map attributes, Object value)


doInvokeMethod

Object doInvokeMethod(String methodName, Object name, Object args)


getCurrent

Object getCurrent()


getName

Object getName(String methodName)
A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX.
param:
methodName the name of the desired method
return:
the object representing the name


invokeMethod

public Object invokeMethod(String methodName)
Convenience method when no arguments are required
return:
the result of the call
param:
methodName the name of the method to invoke


invokeMethod

public Object invokeMethod(String methodName, Object args)


nodeCompleted

void nodeCompleted(Object parent, Object node)
A hook to allow nodes to be processed once they have had all of their children applied.
param:
node the current node being processed
param:
parent the parent of the node being processed


postNodeCompletion

Object postNodeCompletion(Object parent, Object node)
A hook to allow nodes to be processed once they have had all of their children applied and allows the actual node object that represents the Markup element to be changed
param:
node the current node being processed
param:
parent the parent of the node being processed
return:
the node, possibly new, that represents the markup element


setClosureDelegate

void setClosureDelegate(Closure closure, 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)
param:
closure the closure on which to call setDelegate()
param:
node the node value that we've just created, which could be
a builder


setCurrent

void setCurrent(Object current)


setParent

void setParent(Object parent, Object child)