KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > script > groovy > TestingChildBuilder


1 /*****************************************************************************
2  * Copyright (C) NanoContainer Organization. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  * *
8  * Original code by Aslak Hellesoy and Paul Hammant *
9  *****************************************************************************/

10
11 package org.nanocontainer.script.groovy;
12
13 import groovy.util.NodeBuilder;
14 import org.picocontainer.MutablePicoContainer;
15
16 import java.util.Map JavaDoc;
17
18 /**
19  * @author Paul Hammant
20  * @version $Revision: 3144 $
21  */

22 public class TestingChildBuilder extends NodeBuilder {
23
24     MutablePicoContainer toOperateOn;
25
26     public TestingChildBuilder(MutablePicoContainer toOperateOn) {
27         this.toOperateOn = toOperateOn;
28     }
29
30     protected Object JavaDoc createNode(Object JavaDoc name, Map JavaDoc map) {
31         if (name.equals("component")) {
32             return toOperateOn.registerComponentImplementation(map.remove("key"), (Class JavaDoc) map.remove("class"));
33         } else {
34             return null;
35         }
36     }
37
38 }
39
Popular Tags