KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > validation > samples > simple > beans > ObjectThree


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /**
25  * This generated bean class ObjectThree matches the schema element object-three
26  *
27  * Generated on Wed Aug 20 09:25:27 PDT 2003
28  */

29
30 package com.sun.enterprise.tools.common.validation.samples.simple.beans;
31
32 import org.w3c.dom.*;
33 import org.netbeans.modules.schema2beans.*;
34 import java.beans.*;
35 import java.util.*;
36
37 // BEGIN_NOI18N
38

39 public class ObjectThree extends org.netbeans.modules.schema2beans.BaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc PROPERTY_ONE = "PropertyOne"; // NOI18N
45
static public final String JavaDoc PROPERTY_TWO = "PropertyTwo"; // NOI18N
46
static public final String JavaDoc PROPERTY_THREE = "PropertyThree"; // NOI18N
47
static public final String JavaDoc PROPERTY_FOUR = "PropertyFour"; // NOI18N
48

49     public ObjectThree() {
50         this(Common.USE_DEFAULT_VALUES);
51     }
52
53     public ObjectThree(int options)
54     {
55         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
56         // Properties (see root bean comments for the bean graph)
57
this.createProperty("property-one", // NOI18N
58
PROPERTY_ONE,
59             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
60             String JavaDoc.class);
61         this.createProperty("property-two", // NOI18N
62
PROPERTY_TWO,
63             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
64             String JavaDoc.class);
65         this.createProperty("property-three", // NOI18N
66
PROPERTY_THREE,
67             Common.TYPE_1_N | Common.TYPE_STRING | Common.TYPE_KEY,
68             String JavaDoc.class);
69         this.createProperty("property-four", // NOI18N
70
PROPERTY_FOUR,
71             Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY,
72             String JavaDoc.class);
73         this.initialize(options);
74     }
75
76     // Setting the default values of the properties
77
void initialize(int options)
78     {
79                 
80     }
81
82     // This attribute is mandatory
83
public void setPropertyOne(String JavaDoc value) {
84         this.setValue(PROPERTY_ONE, value);
85     }
86
87     //
88
public String JavaDoc getPropertyOne() {
89         return (String JavaDoc)this.getValue(PROPERTY_ONE);
90     }
91
92     // This attribute is optional
93
public void setPropertyTwo(String JavaDoc value) {
94         this.setValue(PROPERTY_TWO, value);
95     }
96
97     //
98
public String JavaDoc getPropertyTwo() {
99         return (String JavaDoc)this.getValue(PROPERTY_TWO);
100     }
101
102     // This attribute is an array containing at least one element
103
public void setPropertyThree(int index, String JavaDoc value) {
104         this.setValue(PROPERTY_THREE, index, value);
105     }
106
107     //
108
public String JavaDoc getPropertyThree(int index) {
109         return (String JavaDoc)this.getValue(PROPERTY_THREE, index);
110     }
111
112     // This attribute is an array containing at least one element
113
public void setPropertyThree(String JavaDoc[] value) {
114         this.setValue(PROPERTY_THREE, value);
115     }
116
117     //
118
public String JavaDoc[] getPropertyThree() {
119         return (String JavaDoc[])this.getValues(PROPERTY_THREE);
120     }
121
122     // Return the number of properties
123
public int sizePropertyThree() {
124         return this.size(PROPERTY_THREE);
125     }
126
127     // Add a new element returning its index in the list
128
public int addPropertyThree(String JavaDoc value) {
129         return this.addValue(PROPERTY_THREE, value);
130     }
131
132     //
133
// Remove an element using its reference
134
// Returns the index the element had in the list
135
//
136
public int removePropertyThree(String JavaDoc value) {
137         return this.removeValue(PROPERTY_THREE, value);
138     }
139
140     // This attribute is an array, possibly empty
141
public void setPropertyFour(int index, String JavaDoc value) {
142         this.setValue(PROPERTY_FOUR, index, value);
143     }
144
145     //
146
public String JavaDoc getPropertyFour(int index) {
147         return (String JavaDoc)this.getValue(PROPERTY_FOUR, index);
148     }
149
150     // This attribute is an array, possibly empty
151
public void setPropertyFour(String JavaDoc[] value) {
152         this.setValue(PROPERTY_FOUR, value);
153     }
154
155     //
156
public String JavaDoc[] getPropertyFour() {
157         return (String JavaDoc[])this.getValues(PROPERTY_FOUR);
158     }
159
160     // Return the number of properties
161
public int sizePropertyFour() {
162         return this.size(PROPERTY_FOUR);
163     }
164
165     // Add a new element returning its index in the list
166
public int addPropertyFour(String JavaDoc value) {
167         return this.addValue(PROPERTY_FOUR, value);
168     }
169
170     //
171
// Remove an element using its reference
172
// Returns the index the element had in the list
173
//
174
public int removePropertyFour(String JavaDoc value) {
175         return this.removeValue(PROPERTY_FOUR, value);
176     }
177
178     //
179
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
180         comparators.add(c);
181     }
182
183     //
184
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
185         comparators.remove(c);
186     }
187     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
188         boolean restrictionFailure = false;
189         // Validating property propertyOne
190
if (getPropertyOne() == null) {
191             throw new org.netbeans.modules.schema2beans.ValidateException("getPropertyOne() == null", "propertyOne", this); // NOI18N
192
}
193         // Validating property propertyTwo
194
if (getPropertyTwo() != null) {
195         }
196         // Validating property propertyThree
197
if (sizePropertyThree() == 0) {
198             throw new org.netbeans.modules.schema2beans.ValidateException("sizePropertyThree() == 0", "propertyThree", this); // NOI18N
199
}
200         for (int _index = 0; _index < sizePropertyThree(); ++_index) {
201             String JavaDoc element = getPropertyThree(_index);
202             if (element != null) {
203             }
204         }
205         // Validating property propertyFour
206
for (int _index = 0; _index < sizePropertyFour(); ++_index) {
207             String JavaDoc element = getPropertyFour(_index);
208             if (element != null) {
209             }
210         }
211     }
212
213     // Dump the content of this bean returning it as a String
214
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
215         String JavaDoc s;
216         Object JavaDoc o;
217         org.netbeans.modules.schema2beans.BaseBean n;
218         str.append(indent);
219         str.append("PropertyOne"); // NOI18N
220
str.append(indent+"\t"); // NOI18N
221
str.append("<"); // NOI18N
222
s = this.getPropertyOne();
223         str.append((s==null?"null":s.trim())); // NOI18N
224
str.append(">\n"); // NOI18N
225
this.dumpAttributes(PROPERTY_ONE, 0, str, indent);
226
227         str.append(indent);
228         str.append("PropertyTwo"); // NOI18N
229
str.append(indent+"\t"); // NOI18N
230
str.append("<"); // NOI18N
231
s = this.getPropertyTwo();
232         str.append((s==null?"null":s.trim())); // NOI18N
233
str.append(">\n"); // NOI18N
234
this.dumpAttributes(PROPERTY_TWO, 0, str, indent);
235
236         str.append(indent);
237         str.append("PropertyThree["+this.sizePropertyThree()+"]"); // NOI18N
238
for(int i=0; i<this.sizePropertyThree(); i++)
239         {
240             str.append(indent+"\t");
241             str.append("#"+i+":");
242             str.append(indent+"\t"); // NOI18N
243
str.append("<"); // NOI18N
244
s = this.getPropertyThree(i);
245             str.append((s==null?"null":s.trim())); // NOI18N
246
str.append(">\n"); // NOI18N
247
this.dumpAttributes(PROPERTY_THREE, i, str, indent);
248         }
249
250         str.append(indent);
251         str.append("PropertyFour["+this.sizePropertyFour()+"]"); // NOI18N
252
for(int i=0; i<this.sizePropertyFour(); i++)
253         {
254             str.append(indent+"\t");
255             str.append("#"+i+":");
256             str.append(indent+"\t"); // NOI18N
257
str.append("<"); // NOI18N
258
s = this.getPropertyFour(i);
259             str.append((s==null?"null":s.trim())); // NOI18N
260
str.append(">\n"); // NOI18N
261
this.dumpAttributes(PROPERTY_FOUR, i, str, indent);
262         }
263
264     }
265     public String JavaDoc dumpBeanNode(){
266         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
267         str.append("ObjectThree\n"); // NOI18N
268
this.dump(str, "\n "); // NOI18N
269
return str.toString();
270     }}
271
272 // END_NOI18N
273

274
275 /*
276         The following schema file has been used for generation:
277
278 <?xml version="1.0" encoding="UTF-8"?>
279 <!--
280     Document : sample.dtd
281     Created on : May 8, 2003, 11:18 AM
282     Author : Rajeshwar Patil
283     Description:
284         Purpose of the document follows.
285 -->
286
287 <!--
288 -->
289 <!ELEMENT root-element (non-zero-length-property, number-property+,
290     boolean-property*, range-property?, enumeration-property,
291     object-one, object-two?, object-three?, object-four,
292     object-five*, object-six+, object-seven*,object-eight*)>
293
294 <!--
295 -->
296 <!ELEMENT object-one (property-one, property-two?)>
297
298
299 <!--
300 -->
301 <!ELEMENT object-two (property-one, property-two)>
302
303
304 <!--
305 -->
306 <!ELEMENT object-three (property-one, property-two?,
307     property-three+, property-four*)>
308
309
310 <!--
311 -->
312 <!ELEMENT object-four (property-one?, property-two?)>
313
314
315 <!--
316 -->
317 <!ELEMENT object-five (property-one, property-two?)>
318
319
320 <!--
321 -->
322 <!ELEMENT object-six (property-one?, property-two?)>
323
324
325 <!--
326 -->
327 <!ELEMENT object-seven (property-one, property-two)>
328
329
330 <!--
331 -->
332 <!ELEMENT object-eight (property-one, property-two?, child-object-one,
333     child-object-two?, child-object-three*, child-object-four+)>
334
335
336 <!--
337 -->
338 <!ELEMENT child-object-one (property-one, property-two?)>
339
340
341 <!--
342 -->
343 <!ELEMENT child-object-two (property-one, property-two)>
344
345
346 <!--
347 -->
348 <!ELEMENT child-object-three (property-one?, property-two?)>
349
350
351 <!--
352 -->
353 <!ELEMENT child-object-four (property-one, property-two?,
354     property-three+, property-four*)>
355
356
357 <!ELEMENT boolean-property (#PCDATA)>
358 <!ELEMENT number-property (#PCDATA)>
359 <!ELEMENT non-zero-length-property (#PCDATA)>
360 <!ELEMENT range-property (#PCDATA)>
361 <!ELEMENT enumeration-property (#PCDATA)>
362 <!ELEMENT property-one (#PCDATA)>
363 <!ELEMENT property-two (#PCDATA)>
364 <!ELEMENT property-three (#PCDATA)>
365 <!ELEMENT property-four (#PCDATA)>
366
367 */

368
Popular Tags