KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > validation > samples > simple > beans > ObjectFour


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 /**
21  * This generated bean class ObjectFour matches the schema element object-four
22  *
23  */

24
25 package org.netbeans.modules.j2ee.sun.validation.samples.simple.beans;
26
27 import org.w3c.dom.*;
28 import org.netbeans.modules.schema2beans.*;
29 import java.beans.*;
30 import java.util.*;
31
32 // BEGIN_NOI18N
33

34 public class ObjectFour extends org.netbeans.modules.schema2beans.BaseBean
35 {
36
37     static Vector comparators = new Vector();
38
39     static public final String JavaDoc PROPERTY_ONE = "PropertyOne"; // NOI18N
40
static public final String JavaDoc PROPERTY_TWO = "PropertyTwo"; // NOI18N
41

42     public ObjectFour() {
43         this(Common.USE_DEFAULT_VALUES);
44     }
45
46     public ObjectFour(int options)
47     {
48         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
49         // Properties (see root bean comments for the bean graph)
50
this.createProperty("property-one", // NOI18N
51
PROPERTY_ONE,
52             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
53             String JavaDoc.class);
54         this.createProperty("property-two", // NOI18N
55
PROPERTY_TWO,
56             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
57             String JavaDoc.class);
58         this.initialize(options);
59     }
60
61     // Setting the default values of the properties
62
void initialize(int options)
63     {
64         
65     }
66
67     // This attribute is optional
68
public void setPropertyOne(String JavaDoc value) {
69         this.setValue(PROPERTY_ONE, value);
70     }
71
72     //
73
public String JavaDoc getPropertyOne() {
74         return (String JavaDoc)this.getValue(PROPERTY_ONE);
75     }
76
77     // This attribute is optional
78
public void setPropertyTwo(String JavaDoc value) {
79         this.setValue(PROPERTY_TWO, value);
80     }
81
82     //
83
public String JavaDoc getPropertyTwo() {
84         return (String JavaDoc)this.getValue(PROPERTY_TWO);
85     }
86
87     //
88
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
89         comparators.add(c);
90     }
91
92     //
93
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
94         comparators.remove(c);
95     }
96     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
97         boolean restrictionFailure = false;
98         // Validating property propertyOne
99
if (getPropertyOne() != null) {
100         }
101         // Validating property propertyTwo
102
if (getPropertyTwo() != null) {
103         }
104     }
105
106     // Dump the content of this bean returning it as a String
107
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
108         String JavaDoc s;
109         Object JavaDoc o;
110         org.netbeans.modules.schema2beans.BaseBean n;
111         str.append(indent);
112         str.append("PropertyOne"); // NOI18N
113
str.append(indent+"\t"); // NOI18N
114
str.append("<"); // NOI18N
115
s = this.getPropertyOne();
116         str.append((s==null?"null":s.trim())); // NOI18N
117
str.append(">\n"); // NOI18N
118
this.dumpAttributes(PROPERTY_ONE, 0, str, indent);
119
120         str.append(indent);
121         str.append("PropertyTwo"); // NOI18N
122
str.append(indent+"\t"); // NOI18N
123
str.append("<"); // NOI18N
124
s = this.getPropertyTwo();
125         str.append((s==null?"null":s.trim())); // NOI18N
126
str.append(">\n"); // NOI18N
127
this.dumpAttributes(PROPERTY_TWO, 0, str, indent);
128
129     }
130     public String JavaDoc dumpBeanNode(){
131         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
132         str.append("ObjectFour\n"); // NOI18N
133
this.dump(str, "\n "); // NOI18N
134
return str.toString();
135     }}
136
137 // END_NOI18N
138

139
140 /*
141         The following schema file has been used for generation:
142
143 <?xml version="1.0" encoding="UTF-8"?>
144 <!--
145     Document : sample.dtd
146     Created on : May 8, 2003, 11:18 AM
147     Author : Rajeshwar Patil
148     Description:
149         Purpose of the document follows.
150 -->
151
152 <!--
153 -->
154 <!ELEMENT root-element (non-zero-length-property, number-property+,
155     boolean-property*, range-property?, enumeration-property,
156     object-one, object-two?, object-three?, object-four,
157     object-five*, object-six+, object-seven*,object-eight*)>
158
159 <!--
160 -->
161 <!ELEMENT object-one (property-one, property-two?)>
162
163
164 <!--
165 -->
166 <!ELEMENT object-two (property-one, property-two)>
167
168
169 <!--
170 -->
171 <!ELEMENT object-three (property-one, property-two?,
172     property-three+, property-four*)>
173
174
175 <!--
176 -->
177 <!ELEMENT object-four (property-one?, property-two?)>
178
179
180 <!--
181 -->
182 <!ELEMENT object-five (property-one, property-two?)>
183
184
185 <!--
186 -->
187 <!ELEMENT object-six (property-one?, property-two?)>
188
189
190 <!--
191 -->
192 <!ELEMENT object-seven (property-one, property-two)>
193
194
195 <!--
196 -->
197 <!ELEMENT object-eight (property-one, property-two?, child-object-one,
198     child-object-two?, child-object-three*, child-object-four+)>
199
200
201 <!--
202 -->
203 <!ELEMENT child-object-one (property-one, property-two?)>
204
205
206 <!--
207 -->
208 <!ELEMENT child-object-two (property-one, property-two)>
209
210
211 <!--
212 -->
213 <!ELEMENT child-object-three (property-one?, property-two?)>
214
215
216 <!--
217 -->
218 <!ELEMENT child-object-four (property-one, property-two?,
219     property-three+, property-four*)>
220
221
222 <!ELEMENT boolean-property (#PCDATA)>
223 <!ELEMENT number-property (#PCDATA)>
224 <!ELEMENT non-zero-length-property (#PCDATA)>
225 <!ELEMENT range-property (#PCDATA)>
226 <!ELEMENT enumeration-property (#PCDATA)>
227 <!ELEMENT property-one (#PCDATA)>
228 <!ELEMENT property-two (#PCDATA)>
229 <!ELEMENT property-three (#PCDATA)>
230 <!ELEMENT property-four (#PCDATA)>
231
232 */

233
Popular Tags