Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.nanocontainer.script.groovy.buildernodes
Class AbstractBuilderNode

    java.lang.Object
      org.nanocontainer.script.groovy.buildernodes.AbstractBuilderNode

All Implemented Interfaces:
  Serializable, BuilderNode

Direct Known Subclasses:
  AppendContainerNode, BeanNode, ChildContainerNode, ClassLoaderNode, ClasspathNode, ComponentNode, DecoratingPicoContainerNode, DoCallNode, GrantNode, NewBuilderNode

    public abstract class AbstractBuilderNode

extends Object
implements BuilderNode, Serializable

Abstract base class for custom nodes. Also provides basic services and construction capabilities.

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

Constructor Summary
`AbstractBuilderNode(String nodeName)` Constructs a custom node builder.

Method Summary
`protected AbstractBuilderNode` | `addAttribute(String name)` Add an attribute to the list of ones supported by this node.
`String` | `getNodeName()` Retrieve the name of the node.
`Set` | `getSupportedAttributes()` Retrieve a map of supported attribute names.
`protected boolean` | `isAttribute(Map attributes, String key)` Checks that an attribute actually exists in the attirbute map.
`String` | `toString()`
`void` | `validateScriptedAttributes(Map specifiedAttributes)` Validates a given map of attributes as supplied by the GroovyNodeBuilder against the node's supported attributes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.nanocontainer.script.groovy.BuilderNode
`createNewNode`

Constructor Detail

### AbstractBuilderNode

    public AbstractBuilderNode(String nodeName)

  Constructs a custom node builder. In derived classes you would typically create a default constructor and call addPossibleParent()/addAttribute() to customize the validation capabilities of the Node.

  Parameters:
    `nodeName` - the name of the node we're constructing.

Method Detail

### addAttribute

    protected AbstractBuilderNode addAttribute(String name)

  Add an attribute to the list of ones supported by this node.

  Parameters:
    `name` - String the name of the attribute we support.
  Returns:
    AbstractBuilderNode (this) to allow for method chaining.

### getNodeName

    public String getNodeName()

  Description copied from interface: `BuilderNode`
  Retrieve the name of the node. Examples could be 'container' or 'component'.

  Specified by:
    `getNodeName` in interface `BuilderNode`
  Returns:
    String

### getSupportedAttributes

    public Set getSupportedAttributes()

  Description copied from interface: `BuilderNode`
  Retrieve a map of supported attribute names.

  note:Supported attributes are currently unverified by the GroovyNodeBuilder as this would result in a change of behavior.

  Specified by:
    `getSupportedAttributes` in interface `BuilderNode`
  Returns:
    Set of Strings.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### isAttribute

    protected boolean isAttribute(Map attributes,
                                  String key)

  Checks that an attribute actually exists in the attirbute map. (The key exists and the value is non-null)

  Parameters:
    `attributes` - Map the current node's attributes.
    `key` - String the attribute key we're looking for.
  Returns:
    boolean true if the attribute exists for the current node.

### validateScriptedAttributes

    public void validateScriptedAttributes(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.

  Specified by:
    `validateScriptedAttributes` in interface `BuilderNode`
  Parameters:
    `specifiedAttributes` - the attributes as passed in by the groovy script.
  Throws:
    `org.nanocontainer.script.NanoContainerMarkupException` - if an attribute is specified that is not recognized.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2007 Codehaus. All Rights Reserved.