|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.util.BuilderSupport
org.picocontainer.script.groovy.GroovyNodeBuilder
public class GroovyNodeBuilder
Builds node trees of PicoContainers and Pico components using GroovyMarkup.
Simple example usage in your groovy script:
builder = new org.picocontainer.script.groovy.GroovyNodeBuilder() pico = builder.container(parent:parent) { component(class:org.picocontainer.script.testmodel.DefaultWebServerConfig) component(class:org.picocontainer.script.testmodel.WebServerImpl) }
Often-times people need there own assembly commands that are needed for extending/enhancing the node builder tree. For example, a typical extension may be to provide AOP vocabulary for the node builder with terms such as 'aspect', 'pointcut', etc.
GroovyNodeBuilder provides two primary ways of enhancing the nodes supported
by the groovy builder:
NodeBuilderDecorator
and special node handlers BuilderNode
. Using
NodeBuilderDecorator is often a preferred method because it is ultimately
script independent. However, replacing an existing GroovyNodeBuilder's
behavior is currently the only way to replace the behavior of an existing
groovy node handler.
Field Summary | |
---|---|
static boolean |
PERFORM_ATTRIBUTE_VALIDATION
Flag indicating that the attribute validation should be performed. |
static boolean |
SKIP_ATTRIBUTE_VALIDATION
Flag indicating that attribute validation should be skipped. |
Constructor Summary | |
---|---|
GroovyNodeBuilder()
Default constructor. |
|
GroovyNodeBuilder(NodeBuilderDecorator decorator)
|
|
GroovyNodeBuilder(NodeBuilderDecorator decorator,
boolean performAttributeValidation)
Allows the composition of a NodeBuilderDecorator -- an
object that extends the capabilities of the GroovyNodeBuilder
with new tags, new capabilities, etc. |
Method Summary | |
---|---|
protected Object |
createNode(Object name)
|
protected Object |
createNode(Object name,
Map attributes)
|
protected Object |
createNode(Object name,
Map attributes,
Object value)
Override of create node. |
protected Object |
createNode(Object name,
Object value)
|
protected Object |
doInvokeMethod(String s,
Object name,
Object args)
|
NodeBuilderDecorator |
getDecorator()
Returns the current decorator |
BuilderNode |
getNode(String tagName)
Returns an appropriate node handler for a given node and |
GroovyNodeBuilder |
setNode(BuilderNode newGroovyNode)
Add's a groovy node handler to the table of possible handlers. |
protected void |
setParent(Object parent,
Object child)
|
Methods inherited from class groovy.util.BuilderSupport |
---|
getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent |
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 |
---|
public static final boolean PERFORM_ATTRIBUTE_VALIDATION
public static final boolean SKIP_ATTRIBUTE_VALIDATION
Constructor Detail |
---|
public GroovyNodeBuilder(NodeBuilderDecorator decorator, boolean performAttributeValidation)
NodeBuilderDecorator
-- an
object that extends the capabilities of the GroovyNodeBuilder
with new tags, new capabilities, etc.
decorator
- NodeBuilderDecoratorperformAttributeValidation
- should be set to
PERFORM_ATTRIBUTE_VALIDATION or SKIP_ATTRIBUTE_VALIDATIONpublic GroovyNodeBuilder(NodeBuilderDecorator decorator)
public GroovyNodeBuilder()
Method Detail |
---|
protected void setParent(Object parent, Object child)
setParent
in class groovy.util.BuilderSupport
protected Object doInvokeMethod(String s, Object name, Object args)
doInvokeMethod
in class groovy.util.BuilderSupport
protected Object createNode(Object name)
createNode
in class groovy.util.BuilderSupport
protected Object createNode(Object name, Object value)
createNode
in class groovy.util.BuilderSupport
protected Object createNode(Object name, Map attributes, Object value)
createNode
in class groovy.util.BuilderSupport
name
- The name of the groovy node we're building. Examples are
'container', and 'grant',attributes
- Map attributes of the current invocation.value
- A closure passed into the node. Currently unused.
public NodeBuilderDecorator getDecorator()
null
.public BuilderNode getNode(String tagName)
tagName
- String
public GroovyNodeBuilder setNode(BuilderNode newGroovyNode)
newGroovyNode
- CustomGroovyNode
protected Object createNode(Object name, Map attributes)
createNode
in class groovy.util.BuilderSupport
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |