    001    package org.nanocontainer.script.groovy;
    002
    003    import java.util.Map;
    004    import java.util.Set;
    005    import org.nanocontainer.script.NanoContainerMarkupException;
    006
    007    /**
    008     * In a groovy node builder environment, there is often one class per
    009     * node that is possible in a builder.  This interface provides the necessary
    010     * validation and interaction methods for the mediator (The GroovyNodeBuilder
    011     * object) to figure out who should handle what.
    012     * @author Michael Rimov
    013     * @version 1.0
    014     */
    015    public interface BuilderNode {
    016
    017        /**
    018         * Retrieve the name of the node.  Examples could be 'container' or 'component'.
    019         * @return String
    020         */
    021        String getNodeName();
    022
    023        /**
    024         * Retrieve a map of supported attribute names.
    025         * <p><strong>note:</strong>Supported attributes are currently unverified by the
    026         * GroovyNodeBuilder as this would result in a change of behavior.</p>
    027         * @return Set of Strings.
    028         */
    029        Set getSupportedAttributes();
    030
    031
    032        /**
    033         * Validates a given map of attributes as supplied by the GroovyNodeBuilder
    034         * against the node's supported attributes.
    035         * @param specifiedAttributes Map
    036         * @throws NanoContainerMarkupException
    037         */
    038        void validateScriptedAttributes(Map specifiedAttributes) throws NanoContainerMarkupException;
    039
    040        /**
    041         * Execute the handler for the given node builder.
    042         * @param current the current object.  May be null
    043         * for no parent container.
    044         * @param attributes Map attributes specified in the groovy script
    045         * for the builder node.
    046         * in for consistency with the Groovy Builder API.  Normally set to null.
    047         * @return Object
    048         * @throws NanoContainerMarkupException upon Nanocontainer error.
    049         */
    050        Object createNewNode(Object current, Map attributes) throws NanoContainerMarkupException;
    051    }