KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > script > groovy > buildernodes > ClasspathNode


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 James Strachan *
9  *****************************************************************************/

10
11 package org.nanocontainer.script.groovy.buildernodes;
12
13 import java.util.Map JavaDoc;
14
15 import org.nanocontainer.NanoContainer;
16 import org.nanocontainer.script.ClassPathElementHelper;
17
18 import org.nanocontainer.ClassPathElement;
19
20 /**
21  * @author James Strachan
22  * @author Paul Hammant
23  * @author Aslak Hellesøy
24  * @author Michael Rimov
25  * @author Mauro Talevi
26  * @version $Revision: 2695 $
27  */

28 public class ClasspathNode extends AbstractBuilderNode {
29
30     public static final String JavaDoc NODE_NAME = "classPathElement";
31
32
33     private static final String JavaDoc PATH = "path";
34
35
36     public ClasspathNode() {
37         super(NODE_NAME);
38
39         addAttribute(PATH);
40     }
41
42
43     public Object JavaDoc createNewNode(Object JavaDoc current, Map JavaDoc attributes) {
44         return createClassPathElementNode(attributes, (NanoContainer) current);
45     }
46
47     private ClassPathElement createClassPathElementNode(Map JavaDoc attributes, NanoContainer nanoContainer) {
48
49         final String JavaDoc path = (String JavaDoc) attributes.remove(PATH);
50         return ClassPathElementHelper.addClassPathElement(path, nanoContainer);
51     }
52
53 }
54
Popular Tags