org.nanocontainer.script.groovy.buildernodes
Class BeanNode

java.lang.Object
  extended by org.nanocontainer.script.groovy.buildernodes.AbstractBuilderNode
      extended by org.nanocontainer.script.groovy.buildernodes.BeanNode
All Implemented Interfaces:
java.io.Serializable, BuilderNode

public class BeanNode
extends AbstractBuilderNode

Creates on-the-spot Javabeans configurations and registers the result with the container via pico.registerCompoenntInstance.

Version:
$Revision: 2695 $
Author:
James Strachan, Paul Hammant, Aslak Hellesøy, Michael Rimov, Mauro Talevi
See Also:
Serialized Form

Field Summary
static java.lang.String BEAN_CLASS
          Bean class attribute.
static java.lang.String NODE_NAME
          The name of the node we're handling.
 
Constructor Summary
BeanNode()
          Default constructor.
 
Method Summary
protected  java.lang.Object createBean(java.util.Map attributes)
          Instantiates the bean and sets the appropriate attributes.
 java.lang.Object createNewNode(java.lang.Object current, java.util.Map attributes)
          Execute the handler for the given node builder.
 void validateScriptedAttributes(java.util.Map specifiedAttributes)
          Validates a given map of attributes as supplied by the GroovyNodeBuilder against the node's supported attributes.
 
Methods inherited from class org.nanocontainer.script.groovy.buildernodes.AbstractBuilderNode
addAttribute, getNodeName, getSupportedAttributes, isAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NODE_NAME

public static final java.lang.String NODE_NAME
The name of the node we're handling.

See Also:
Constant Field Values

BEAN_CLASS

public static final java.lang.String BEAN_CLASS
Bean class attribute.

See Also:
Constant Field Values
Constructor Detail

BeanNode

public BeanNode()
Default constructor.

Method Detail

createNewNode

public java.lang.Object createNewNode(java.lang.Object current,
                                      java.util.Map attributes)
Description copied from interface: BuilderNode
Execute the handler for the given node builder.

Parameters:
current - the current object. May be null for no parent container.
attributes - Map attributes specified in the groovy script for the builder node. in for consistency with the Groovy Builder API. Normally set to null.
Returns:
Object

createBean

protected java.lang.Object createBean(java.util.Map attributes)
Instantiates the bean and sets the appropriate attributes. It then

Parameters:
attributes - Map
Returns:
Object resulting JavaBean.

validateScriptedAttributes

public void validateScriptedAttributes(java.util.Map specifiedAttributes)
                                throws org.nanocontainer.script.NanoContainerMarkupException
Validates a given map of attributes as supplied by the GroovyNodeBuilder against the node's supported attributes.

This particular implementation checks all specified attribute keynames against the names supported in the node type. It does not type checking against the values passed in via the attributes.

This version only checks for 'beanClass' and lets all other attributes through (since they become property values)

Specified by:
validateScriptedAttributes in interface BuilderNode
Overrides:
validateScriptedAttributes in class AbstractBuilderNode
Parameters:
specifiedAttributes - Map
Throws:
org.nanocontainer.script.NanoContainerMarkupException


Copyright © 2003-2009 Codehaus. All Rights Reserved.