KickJava   Java API By Example, From Geeks To Geeks.

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


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 ObjectSeven matches the schema element object-seven
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 ObjectSeven 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

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

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

240
Popular Tags