Package groovy.util
Class BuilderSupport
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.BuilderSupport
- All Implemented Interfaces:
- GroovyObject
- Direct Known Subclasses:
- AntBuilder,- AntBuilder,- DOMBuilder,- MarkupBuilder,- NamespaceBuilderSupport,- NodeBuilder,- SAXBuilder
public abstract class BuilderSupport extends GroovyObjectSupport
Base class for creating arbitrary nested trees of objects or events.
- 
Constructor SummaryConstructors Constructor Description BuilderSupport()BuilderSupport(Closure nameMappingClosure, BuilderSupport proxyBuilder)BuilderSupport(BuilderSupport proxyBuilder)
- 
Method SummaryModifier and Type Method Description protected abstract java.lang.ObjectcreateNode(java.lang.Object name)protected abstract java.lang.ObjectcreateNode(java.lang.Object name, java.lang.Object value)protected abstract java.lang.ObjectcreateNode(java.lang.Object name, java.util.Map attributes)protected abstract java.lang.ObjectcreateNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)protected java.lang.ObjectdoInvokeMethod(java.lang.String methodName, java.lang.Object name, java.lang.Object args)protected java.lang.ObjectgetCurrent()protected java.lang.ObjectgetName(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.ObjectinvokeMethod(java.lang.String methodName)Convenience method when no arguments are required.java.lang.ObjectinvokeMethod(java.lang.String methodName, java.lang.Object args)Invokes the given method.protected voidnodeCompleted(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 java.lang.ObjectpostNodeCompletion(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 and allows the actual node object that represents the Markup element to be changed.protected voidsetClosureDelegate(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 voidsetCurrent(java.lang.Object current)protected abstract voidsetParent(java.lang.Object parent, java.lang.Object child)Methods inherited from class groovy.lang.GroovyObjectSupportgetMetaClass, setMetaClassMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObjectgetProperty, setProperty
- 
Constructor Details- 
BuilderSupportpublic BuilderSupport()
- 
BuilderSupport
- 
BuilderSupport
 
- 
- 
Method Details- 
getCurrentprotected java.lang.Object getCurrent()
- 
setCurrentprotected void setCurrent(java.lang.Object current)
- 
invokeMethodpublic java.lang.Object invokeMethod(java.lang.String methodName)Convenience method when no arguments are required.- Parameters:
- methodName- the name of the method to invoke
- Returns:
- the result of the call
 
- 
invokeMethodpublic java.lang.Object invokeMethod(java.lang.String methodName, java.lang.Object args)Description copied from interface:GroovyObjectInvokes the given method.- Parameters:
- methodName- the name of the method to call
- args- the arguments to use for the method call
- Returns:
- the result of invoking the method
 
- 
doInvokeMethodprotected java.lang.Object doInvokeMethod(java.lang.String methodName, java.lang.Object name, java.lang.Object args)
- 
setClosureDelegateA 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
 
- 
setParentprotected abstract void setParent(java.lang.Object parent, java.lang.Object child)
- 
createNodeprotected abstract java.lang.Object createNode(java.lang.Object name)
- 
createNodeprotected abstract java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
- 
createNodeprotected abstract java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)
- 
createNodeprotected abstract java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
- 
getNameprotected 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- the name of the desired method
- Returns:
- the object representing the name
 
- 
nodeCompletedprotected 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.- Parameters:
- node- the current node being processed
- parent- the parent of the node being processed
 
- 
postNodeCompletionprotected java.lang.Object postNodeCompletion(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 and allows the actual node object that represents the Markup element to be changed.- Parameters:
- node- the current node being processed
- parent- the parent of the node being processed
- Returns:
- the node, possibly new, that represents the markup element
 
 
-