KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > module > spi > TaskStructure


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.apache.tools.ant.module.spi;
21
22 import java.util.Set JavaDoc;
23 import org.apache.tools.ant.module.run.LoggerTrampoline;
24
25 /**
26  * Describes the structure of a task.
27  * Each instance corresponds to one task or nested element in a build script.
28  * @author Jesse Glick
29  * @since org.apache.tools.ant.module/3 3.12
30  */

31 public final class TaskStructure {
32
33     static {
34         LoggerTrampoline.TASK_STRUCTURE_CREATOR = new LoggerTrampoline.Creator() {
35             public AntSession makeAntSession(LoggerTrampoline.AntSessionImpl impl) {
36                 throw new AssertionError JavaDoc();
37             }
38             public AntEvent makeAntEvent(LoggerTrampoline.AntEventImpl impl) {
39                 throw new AssertionError JavaDoc();
40             }
41             public TaskStructure makeTaskStructure(LoggerTrampoline.TaskStructureImpl impl) {
42                 return new TaskStructure(impl);
43             }
44         };
45     }
46     
47     private final LoggerTrampoline.TaskStructureImpl impl;
48     private TaskStructure(LoggerTrampoline.TaskStructureImpl impl) {
49         this.impl = impl;
50     }
51     
52     /**
53      * Get the element name.
54      * XXX precise behavior w.r.t. namespaces etc.
55      * @return a name, never null
56      */

57     public String JavaDoc getName() {
58         return impl.getName();
59     }
60     
61     /**
62      * Get a single attribute.
63      * It will be unevaluated as configured in the script.
64      * If you wish to find the actual runtime value, you may
65      * use {@link AntEvent#evaluate}.
66      * @param name the attribute name
67      * @return the raw value of that attribute, or null
68      */

69     public String JavaDoc getAttribute(String JavaDoc name) {
70         return impl.getAttribute(name);
71     }
72     
73     /**
74      * Get a set of all defined attribute names.
75      * @return a set of names suitable for {@link #getAttribute}; may be empty but not null
76      */

77     public Set JavaDoc<String JavaDoc> getAttributeNames() {
78         return impl.getAttributeNames();
79     }
80     
81     /**
82      * Get configured nested text.
83      * It will be unevaluated as configured in the script.
84      * If you wish to find the actual runtime value, you may
85      * use {@link AntEvent#evaluate}.
86      * @return the raw text contained in the element, or null
87      */

88     public String JavaDoc getText() {
89         return impl.getText();
90     }
91
92     /**
93      * Get any configured child elements.
94      * @return a list of child structure elements; may be empty but not null
95      */

96     public TaskStructure[] getChildren() {
97         return impl.getChildren();
98     }
99     
100     @Override JavaDoc
101     public String JavaDoc toString() {
102         return impl.toString();
103     }
104     
105 }
106
Popular Tags