org.picocontainer.script.groovy.nodes
Class AppendContainerNode

java.lang.Object
  extended by org.picocontainer.script.groovy.nodes.AbstractBuilderNode
      extended by org.picocontainer.script.groovy.nodes.AppendContainerNode
All Implemented Interfaces:
Serializable, BuilderNode

public class AppendContainerNode
extends AbstractBuilderNode

Sometimes it is worthwhile to split apart node building into functions. For example, you might want to group adding the domain object repositories (DAOs) into a single function to make your composition script easier to maintain.

Unfortunately, normally this is not allowed under normal builder rules. If you wish to separate code you must revert to standard picocontainer calling systax.

This node corrects that deficiency.

With it you can perform:

 pico = builder.container(parent:parent) {
   component(....)
   //...
 }
 <br/>
 //
 
 Now add more to pico.
 
 builder.append(container: pico) {
   component(....)
   //...
 }
 

Author:
Michael Rimov
See Also:
Serialized Form

Field Summary
static String CONTAINER
          Supported Attribute (Required): 'container.' Reference to the container we are going to append to.
static String NODE_NAME
          Node name.
 
Constructor Summary
AppendContainerNode()
          Constructs an append container node.
 
Method Summary
 Object createNewNode(Object current, Map<String,Object> attributes)
          Returns the container passed in as the "container" attribute.
 
Methods inherited from class org.picocontainer.script.groovy.nodes.AbstractBuilderNode
addAttribute, getNodeName, getSupportedAttributeNames, isAttribute, toString, validateScriptedAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NODE_NAME

public static final String NODE_NAME
Node name.

See Also:
Constant Field Values

CONTAINER

public static final String CONTAINER
Supported Attribute (Required): 'container.' Reference to the container we are going to append to.

See Also:
Constant Field Values
Constructor Detail

AppendContainerNode

public AppendContainerNode()
Constructs an append container node.

Method Detail

createNewNode

public Object createNewNode(Object current,
                            Map<String,Object> attributes)
                     throws ScriptedPicoContainerMarkupException,
                            ClassCastException
Returns the container passed in as the "container" attribute.

Parameters:
current - the current Object, unused.
attributes - the Map of attributes, which must have the container attribute defined.
Returns:
Object the passed in node builder.
Throws:
ScriptedPicoContainerMarkupException - if the container attribute is not supplied.
ClassCastException - if the container node specified is not a ScriptedPicoContainer or PicoContainer


Copyright © 2003-2010 Codehaus. All Rights Reserved.