KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

238
Popular Tags