org.picocontainer.script.groovy.nodes
Class BeanNode

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

public class BeanNode
extends AbstractBuilderNode

Creates on-the-spot Javabeans configurations and registers the result with the container @link MutablePicoContainer#addComponent}.

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

Field Summary
static String BEAN_CLASS
          Bean class attribute.
static String NODE_NAME
          The name of the node we're handling.
 
Constructor Summary
BeanNode()
          Default constructor.
 
Method Summary
protected  Object createBean(Map<String,Object> attributes)
          Instantiates the bean and sets the appropriate attributes.
 Object createNewNode(Object current, Map<String,Object> attributes)
          Creates a new node .
 void validateScriptedAttributes(Map<String,Object> specifiedAttributes)
          Validates a the attributes as supplied by the node builder against the node's supported attributes.
 
Methods inherited from class org.picocontainer.script.groovy.nodes.AbstractBuilderNode
addAttribute, getNodeName, getSupportedAttributeNames, 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 String NODE_NAME
The name of the node we're handling.

See Also:
Constant Field Values

BEAN_CLASS

public static final String BEAN_CLASS
Bean class attribute.

See Also:
Constant Field Values
Constructor Detail

BeanNode

public BeanNode()
Default constructor.

Method Detail

createNewNode

public Object createNewNode(Object current,
                            Map<String,Object> attributes)
Description copied from interface: BuilderNode
Creates a new node .

Parameters:
current - the current Object - may be null for no parent container.
attributes - the Map of scripted attributes for the builder node - may be null
Returns:
The newly created node

createBean

protected Object createBean(Map<String,Object> attributes)
Instantiates the bean and sets the appropriate attributes. It then

Parameters:
attributes - Map
Returns:
Object resulting JavaBean.

validateScriptedAttributes

public void validateScriptedAttributes(Map<String,Object> specifiedAttributes)
                                throws ScriptedPicoContainerMarkupException
Validates a the attributes as supplied by the node builder 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:
ScriptedPicoContainerMarkupException


Copyright © 2003-2010 Codehaus. All Rights Reserved.