KickJava   Java API By Example, From Geeks To Geeks.

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


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 ObjectFive matches the schema element object-five
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 ObjectFive 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 ObjectFive() {
48         this(Common.USE_DEFAULT_VALUES);
49     }
50
51     public ObjectFive(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_0_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 optional
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         }
110     }
111
112     // Dump the content of this bean returning it as a String
113
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
114         String JavaDoc s;
115         Object JavaDoc o;
116         org.netbeans.modules.schema2beans.BaseBean n;
117         str.append(indent);
118         str.append("PropertyOne"); // NOI18N
119
str.append(indent+"\t"); // NOI18N
120
str.append("<"); // NOI18N
121
s = this.getPropertyOne();
122         str.append((s==null?"null":s.trim())); // NOI18N
123
str.append(">\n"); // NOI18N
124
this.dumpAttributes(PROPERTY_ONE, 0, str, indent);
125
126         str.append(indent);
127         str.append("PropertyTwo"); // NOI18N
128
str.append(indent+"\t"); // NOI18N
129
str.append("<"); // NOI18N
130
s = this.getPropertyTwo();
131         str.append((s==null?"null":s.trim())); // NOI18N
132
str.append(">\n"); // NOI18N
133
this.dumpAttributes(PROPERTY_TWO, 0, str, indent);
134
135     }
136     public String JavaDoc dumpBeanNode(){
137         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
138         str.append("ObjectFive\n"); // NOI18N
139
this.dump(str, "\n "); // NOI18N
140
return str.toString();
141     }}
142
143 // END_NOI18N
144

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

239
Popular Tags