01: /*****************************************************************************
02: * Copyright (C) NanoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by James Strachan *
09: *****************************************************************************/package org.nanocontainer.script.groovy.buildernodes;
10:
11: import java.util.Map;
12:
13: import org.nanocontainer.NanoContainer;
14: import org.nanocontainer.script.ClassPathElementHelper;
15:
16: import org.nanocontainer.ClassPathElement;
17:
18: /**
19: * @author James Strachan
20: * @author Paul Hammant
21: * @author Aslak Hellesøy
22: * @author Michael Rimov
23: * @author Mauro Talevi
24: * @version $Revision: 2695 $
25: */
26: public class ClasspathNode extends AbstractBuilderNode {
27:
28: public static final String NODE_NAME = "classPathElement";
29:
30: private static final String PATH = "path";
31:
32: public ClasspathNode() {
33: super (NODE_NAME);
34:
35: addAttribute(PATH);
36: }
37:
38: public Object createNewNode(Object current, Map attributes) {
39: return createClassPathElementNode(attributes,
40: (NanoContainer) current);
41: }
42:
43: private ClassPathElement createClassPathElementNode(Map attributes,
44: NanoContainer nanoContainer) {
45:
46: final String path = (String) attributes.remove(PATH);
47: return ClassPathElementHelper.addClassPathElement(path,
48: nanoContainer);
49: }
50:
51: }
|