001    /*******************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.
003     * ---------------------------------------------------------------------------
004     * The software in this package is published under the terms of the BSD style
005     * license a copy of which has been included with this distribution in the
006     * LICENSE.txt file.
007     ******************************************************************************/
008    package org.picocontainer.script;
009    
010    import org.picocontainer.MutablePicoContainer;
011    import org.picocontainer.ComponentFactory;
012    
013    import java.util.Map;
014    
015    /**
016     * Null-object implementation of NodeBuilderDecorator
017     * 
018     * @author Aslak Hellesøy
019     * @author Paul Hammant
020     */
021    @SuppressWarnings("unchecked")
022    public class NullNodeBuilderDecorator implements NodeBuilderDecorator {
023        public ComponentFactory decorate(ComponentFactory componentFactory, Map attributes) {
024            return componentFactory;
025        }
026    
027        public MutablePicoContainer decorate(MutablePicoContainer picoContainer) {
028            return picoContainer;
029        }
030    
031        public Object createNode(Object name, Map attributes, Object parentElement) {
032            throw new ScriptedPicoContainerMarkupException("Don't know how to create a '" + name + "' child of a '"
033                    + ((parentElement == null) ? "null" : parentElement.toString()) + "' element");
034        }
035    
036        public void rememberComponentKey(Map attributes) {
037        }
038    }