Top Description Fields Constructors Methods
groovy.util

public abstract Class BuilderSupport

extends GroovyObjectSupport
Class Inheritance
Known Direct Subclasses
groovy.util.NodeBuilder
Imports
groovy.lang.Closure, .GroovyObjectSupport, .GroovyRuntimeException, .MissingMethodException, groovy.transform.stc.ClosureParams, .SimpleType, org.codehaus.groovy.runtime.InvokerHelper, java.util.List, .Map

Base class for creating arbitrary nested trees of objects or events.

Field Summary

Modifier and TypeField and Description
private Object
private Closure<V>
private final BuilderSupport

Constructor Summary

AccessConstructor and Description
public
public
BuilderSupport(final BuilderSupport proxyBuilder)

public
BuilderSupport(final Closure<V> nameMappingClosure, final BuilderSupport proxyBuilder)

Method Summary

Modifier and TypeMethod and Description
protected abstract Object
protected abstract Object
createNode(Object name, Object value)

protected abstract Object
createNode(Object name, Map<K, V> attributes)

protected abstract Object
createNode(Object name, Map<K, V> attributes, Object value)

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

protected Object
protected Object

Returns:

the object representing the name
getName
(final String
the name of the desired method
methodName
)

A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX.

public Object

Returns:

the result of the call
invokeMethod
(final String
the name of the method to invoke
methodName
)

Convenience method when no arguments are required.

public Object
invokeMethod(final String
the name of the method to call
methodName
,
final Object
the arguments to use for the method call
args
)

Overrides default groovy.lang.GroovyObject.invokeMethod.

Invokes the given method.
protected void
nodeCompleted(final Object
the parent of the node being processed
parent
,
final Object
the current node being processed
node
)

A hook to allow nodes to be processed once they have had all of their children applied.

protected Object

Returns:

the node, possibly new, that represents the markup element
postNodeCompletion
(final Object
the parent of the node being processed
parent
,
final Object
the current node being processed
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.

protected void
setClosureDelegate(final Closure<V>
the closure on which to call setDelegate()
closure
,
final Object
the node value that we've just created, which could be a builder
node
)

A strategy method to allow derived builders to use builder-trees and switch in different kinds of builders.

protected void
setCurrent(final Object current)

protected abstract void
setParent(Object parent, Object child)

Inherited from groovy.lang.GroovyObjectSupport:
getMetaClasssetMetaClass

Field Detail

currentback to summary
private Object current
nameMappingClosureback to summary
private Closure<V> nameMappingClosure
proxyBuilderback to summary
private final BuilderSupport proxyBuilder

Constructor Detail

BuilderSupportback to summary
public BuilderSupport()
BuilderSupportback to summary
public BuilderSupport(final BuilderSupport proxyBuilder)
BuilderSupportback to summary
public BuilderSupport(final Closure<V> nameMappingClosure, final BuilderSupport proxyBuilder)

Method Detail

createNodeback to summary
protected abstract Object createNode(Object name)
createNodeback to summary
protected abstract Object createNode(Object name, Object value)
createNodeback to summary
protected abstract Object createNode(Object name, Map<K, V> attributes)
createNodeback to summary
protected abstract Object createNode(Object name, Map<K, V> attributes, Object value)
doInvokeMethodback to summary
protected Object doInvokeMethod(final String methodName, final Object name, final Object args)
getCurrentback to summary
protected Object getCurrent()
getNameback to summary
protected Object getName(final 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:String

the name of the desired method

Returns:Object

the object representing the name

invokeMethodback to summary
public Object invokeMethod(final String methodName)

Convenience method when no arguments are required.

Parameters
methodName:String

the name of the method to invoke

Returns:Object

the result of the call

invokeMethodback to summary
public Object invokeMethod(final String methodName, final Object args)

Overrides default groovy.lang.GroovyObject.invokeMethod.

Doc from groovy.lang.GroovyObject.invokeMethod.

Invokes the given method.

Parameters
methodName:String

the name of the method to call

args:Object

the arguments to use for the method call

Returns:Object

the result of invoking the method

nodeCompletedback to summary
protected void nodeCompleted(final Object parent, final Object node)

A hook to allow nodes to be processed once they have had all of their children applied.

Parameters
parent:Object

the parent of the node being processed

node:Object

the current node being processed

postNodeCompletionback to summary
protected Object postNodeCompletion(final Object parent, final 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.

Parameters
parent:Object

the parent of the node being processed

node:Object

the current node being processed

Returns:Object

the node, possibly new, that represents the markup element

setClosureDelegateback to summary
protected void setClosureDelegate(final Closure<V> closure, final 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:Closure<V>

the closure on which to call setDelegate()

node:Object

the node value that we've just created, which could be a builder

setCurrentback to summary
protected void setCurrent(final Object current)
setParentback to summary
protected abstract void setParent(Object parent, Object child)