KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > dd > impl > transform > Xmltype


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 2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /**
20  * This generated bean class Xmltype matches the schema element 'xmltype'.
21  * The root bean class is Transform
22  *
23  * Generated on Sat Aug 13 01:27:36 GMT-08:00 2005
24  * @Generated
25  */

26
27 package org.netbeans.modules.j2ee.sun.dd.impl.transform;
28
29 import org.w3c.dom.*;
30 import org.netbeans.modules.schema2beans.*;
31 import java.beans.*;
32 import java.util.*;
33
34 // BEGIN_NOI18N
35

36 public class Xmltype extends org.netbeans.modules.schema2beans.BaseBean
37 {
38
39     static Vector comparators = new Vector();
40     private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0);
41
42     static public final String JavaDoc NAME = "Name"; // NOI18N
43
static public final String JavaDoc MOD_ELEMENT = "ModElement"; // NOI18N
44

45     public Xmltype() {
46         this(Common.USE_DEFAULT_VALUES);
47     }
48
49     public Xmltype(int options)
50     {
51         super(comparators, runtimeVersion);
52         // Properties (see root bean comments for the bean graph)
53
initPropertyTables(2);
54         this.createProperty("name", // NOI18N
55
NAME,
56             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
57             String JavaDoc.class);
58         this.createProperty("mod-element", // NOI18N
59
MOD_ELEMENT,
60             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
61             ModElement.class);
62         this.initialize(options);
63     }
64
65     // Setting the default values of the properties
66
void initialize(int options) {
67
68     }
69
70     // This attribute is mandatory
71
public void setName(String JavaDoc value) {
72         this.setValue(NAME, value);
73     }
74
75     //
76
public String JavaDoc getName() {
77         return (String JavaDoc)this.getValue(NAME);
78     }
79
80     // This attribute is an array, possibly empty
81
public void setModElement(int index, ModElement value) {
82         this.setValue(MOD_ELEMENT, index, value);
83     }
84
85     //
86
public ModElement getModElement(int index) {
87         return (ModElement)this.getValue(MOD_ELEMENT, index);
88     }
89
90     // Return the number of properties
91
public int sizeModElement() {
92         return this.size(MOD_ELEMENT);
93     }
94
95     // This attribute is an array, possibly empty
96
public void setModElement(ModElement[] value) {
97         this.setValue(MOD_ELEMENT, value);
98     }
99
100     //
101
public ModElement[] getModElement() {
102         return (ModElement[])this.getValues(MOD_ELEMENT);
103     }
104
105     // Add a new element returning its index in the list
106
public int addModElement(ModElement value) {
107         int positionOfNewItem = this.addValue(MOD_ELEMENT, value);
108         return positionOfNewItem;
109     }
110
111     //
112
// Remove an element using its reference
113
// Returns the index the element had in the list
114
//
115
public int removeModElement(ModElement value) {
116         return this.removeValue(MOD_ELEMENT, value);
117     }
118
119     /**
120      * Create a new bean using it's default constructor.
121      * This does not add it to any bean graph.
122      */

123     public ModElement newModElement() {
124         return new ModElement();
125     }
126
127     //
128
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
129         comparators.add(c);
130     }
131
132     //
133
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
134         comparators.remove(c);
135     }
136     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
137         boolean restrictionFailure = false;
138         boolean restrictionPassed = false;
139         // Validating property name
140
if (getName() == null) {
141             throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "name", this); // NOI18N
142
}
143         // Validating property modElement
144
for (int _index = 0; _index < sizeModElement(); ++_index) {
145             ModElement element = getModElement(_index);
146             if (element != null) {
147                 element.validate();
148             }
149         }
150     }
151
152     // Dump the content of this bean returning it as a String
153
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
154         String JavaDoc s;
155         Object JavaDoc o;
156         org.netbeans.modules.schema2beans.BaseBean n;
157         str.append(indent);
158         str.append("Name"); // NOI18N
159
str.append(indent+"\t"); // NOI18N
160
str.append("<"); // NOI18N
161
o = this.getName();
162         str.append((o==null?"null":o.toString().trim())); // NOI18N
163
str.append(">\n"); // NOI18N
164
this.dumpAttributes(NAME, 0, str, indent);
165
166         str.append(indent);
167         str.append("ModElement["+this.sizeModElement()+"]"); // NOI18N
168
for(int i=0; i<this.sizeModElement(); i++)
169         {
170             str.append(indent+"\t");
171             str.append("#"+i+":");
172             n = (org.netbeans.modules.schema2beans.BaseBean) this.getModElement(i);
173             if (n != null)
174                 n.dump(str, indent + "\t"); // NOI18N
175
else
176                 str.append(indent+"\tnull"); // NOI18N
177
this.dumpAttributes(MOD_ELEMENT, i, str, indent);
178         }
179
180     }
181     public String JavaDoc dumpBeanNode(){
182         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
183         str.append("Xmltype\n"); // NOI18N
184
this.dump(str, "\n "); // NOI18N
185
return str.toString();
186     }}
187
188 // END_NOI18N
189

190
191 /*
192         The following schema file has been used for generation:
193
194
195 <!--- Put your DTDDoc comment here. -->
196 <!ELEMENT transform (xmltype)*>
197
198 <!--- xmltype : target version of the server xml -->
199 <!ELEMENT xmltype (name, mod-element*)>
200
201 <!--- Put your DTDDoc comment here. -->
202 <!ELEMENT name (#PCDATA)>
203
204 <!--- mod-element : element that contains sub-elements and attributes that need to be removed
205       ie. sub-elements and attributes that were added in a later version of server xml -->
206 <!ELEMENT mod-element (name, mod-attribute*, sub-element*)>
207
208 <!--- sub-element : sub-elements that need to be removed -->
209 <!ELEMENT sub-element (name)>
210
211 <!--- new-attribute : attribute that need to be removed -->
212 <!ELEMENT mod-attribute (name)>
213
214
215 */

216
Popular Tags