Package groovy.util
Class BuilderSupport
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.BuilderSupport
- All Implemented Interfaces:
GroovyObject
- Direct Known Subclasses:
AntBuilder
,DOMBuilder
,MarkupBuilder
,NamespaceBuilderSupport
,NodeBuilder
,SAXBuilder
An abstract base class for creating arbitrary nested trees of objects
or events
- Author:
- James Strachan
-
Constructor Summary
ConstructorDescriptionBuilderSupport
(Closure nameMappingClosure, BuilderSupport proxyBuilder) BuilderSupport
(BuilderSupport proxyBuilder) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Object
createNode
(Object name) protected abstract Object
createNode
(Object name, Object value) protected abstract Object
createNode
(Object name, Map attributes) protected abstract Object
createNode
(Object name, Map attributes, Object value) protected Object
doInvokeMethod
(String methodName, Object name, Object args) protected Object
protected Object
A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX.invokeMethod
(String methodName) Convenience method when no arguments are requiredinvokeMethod
(String methodName, Object args) Invokes the given method.protected void
nodeCompleted
(Object parent, Object node) A hook to allow nodes to be processed once they have had all of their children applied.protected 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 changedprotected void
setClosureDelegate
(Closure closure, Object node) A strategy method to allow derived builders to use builder-trees and switch in different kinds of builders.protected void
setCurrent
(Object current) protected abstract void
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
-
Constructor Details
-
BuilderSupport
public BuilderSupport() -
BuilderSupport
-
BuilderSupport
-
-
Method Details
-
invokeMethod
Convenience method when no arguments are required- Parameters:
methodName
- the name of the method to invoke- Returns:
- the result of the call
-
invokeMethod
Description copied from interface:GroovyObject
Invokes the given method.- Specified by:
invokeMethod
in interfaceGroovyObject
- Overrides:
invokeMethod
in classGroovyObjectSupport
- Parameters:
methodName
- the name of the method to callargs
- the arguments to use for the method call- Returns:
- the result of invoking the method
-
doInvokeMethod
-
setClosureDelegate
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
-
createNode
-
createNode
-
createNode
-
createNode
-
getName
A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX.- Parameters:
methodName
- the name of the desired method- Returns:
- the object representing the name
-
nodeCompleted
A hook to allow nodes to be processed once they have had all of their children applied.- Parameters:
node
- the current node being processedparent
- the parent of the node being processed
-
postNodeCompletion
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:
node
- the current node being processedparent
- the parent of the node being processed- Returns:
- the node, possibly new, that represents the markup element
-
getCurrent
-
setCurrent
-