KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > finalist > jag > taglib > TagDef


1 /* Copyright (C) 2003 Finalist IT Group
2  *
3  * This file is part of JAG - the Java J2EE Application Generator
4  *
5  * JAG is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * JAG is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with JAG; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */

17
18 package com.finalist.jag.taglib;
19
20
21 import java.util.Collection JavaDoc;
22 import java.util.*;
23
24
25 /**
26  * Class TagDef
27  *
28  *
29  * @author Wendel D. de Witte
30  * @version %I%, %G%
31  */

32 public class TagDef {
33
34    /** Field name */
35    private String JavaDoc name = null;
36
37    /** Field tagClass */
38    private String JavaDoc tagClass = null;
39
40    /** Field bodyContent */
41    private String JavaDoc bodyContent = null;
42
43    /** Field attrDefs */
44    private Collection JavaDoc attrDefs = null;
45
46
47    /**
48     * Constructor TagDef
49     *
50     *
51     */

52    public TagDef() {
53    }
54
55
56    /**
57     * Constructor TagDef
58     *
59     *
60     * @param n
61     *
62     */

63    public TagDef(TagDef n) {
64
65       this.name = n.name;
66       this.tagClass = n.tagClass;
67       this.bodyContent = n.bodyContent;
68       attrDefs = new ArrayList();
69
70       AttributeDef[] ar = this.getAttributeDefArray();
71
72       for (int i = 0; i < ar.length; i++) {
73          attrDefs.add(new AttributeDef(ar[i]));
74       }
75    }
76
77
78    /**
79     * Method setName
80     *
81     *
82     * @param name
83     *
84     */

85    public void setName(String JavaDoc name) {
86       this.name = name;
87    }
88
89
90    /**
91     * Method setTagClass
92     *
93     *
94     * @param tagClass
95     *
96     */

97    public void setTagClass(String JavaDoc tagClass) {
98       this.tagClass = tagClass;
99    }
100
101
102    /**
103     * Method setAttributeDefs
104     *
105     *
106     * @param attrDefs
107     *
108     */

109    public void setAttributeDefs(Collection JavaDoc attrDefs) {
110       this.attrDefs = attrDefs;
111    }
112
113
114    /**
115     * Method getName
116     *
117     *
118     * @return
119     *
120     */

121    public String JavaDoc getName() {
122       return (this.name);
123    }
124
125
126    /**
127     * Method getTagClass
128     *
129     *
130     * @return
131     *
132     */

133    public String JavaDoc getTagClass() {
134       return (this.tagClass);
135    }
136
137
138    /**
139     * Method getAttributeDefs
140     *
141     *
142     * @return
143     *
144     */

145    public Collection JavaDoc getAttributeDefs() {
146       return (this.attrDefs);
147    }
148
149
150    /**
151     * Method getAttributeDefArray
152     *
153     *
154     * @return
155     *
156     */

157    public AttributeDef[] getAttributeDefArray() {
158
159       int size = attrDefs.size();
160
161       return (AttributeDef[]) attrDefs.toArray(new AttributeDef[size]);
162    }
163
164
165    /**
166     * Method setBodyContent
167     *
168     *
169     * @param bodyContent
170     *
171     */

172    public void setBodyContent(String JavaDoc bodyContent) {
173       this.bodyContent = bodyContent;
174    }
175
176
177    /**
178     * Method getBodyContent
179     *
180     *
181     * @return
182     *
183     */

184    public String JavaDoc getBodyContent() {
185       return (this.bodyContent);
186    }
187
188
189    /**
190     * Method toString
191     *
192     *
193     * @return
194     *
195     */

196    public String JavaDoc toString() {
197       StringBuffer JavaDoc toString = new StringBuffer JavaDoc();
198       toString.append("\nname : ");
199       toString.append(name);
200       toString.append("\ntagClass : ");
201       toString.append(tagClass);
202       toString.append("\nbodyContent : ");
203       toString.append(bodyContent);
204       toString.append("\nattrDefs : ");
205       toString.append(attrDefs);
206
207       return new String JavaDoc(toString);
208    }
209 }
Popular Tags