KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > validation > constraints > data > Argument


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 Argument matches the schema element argument
26  *
27  * Generated on Wed Aug 20 17:20:08 PDT 2003
28  */

29
30 package com.sun.enterprise.tools.common.validation.constraints.data;
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 Argument extends org.netbeans.modules.schema2beans.BaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc NAME = "Name"; // NOI18N
45
static public final String JavaDoc TYPE = "Type"; // NOI18N
46

47     public Argument() {
48         this(Common.USE_DEFAULT_VALUES);
49     }
50
51     public Argument(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("name", // NOI18N
56
NAME,
57             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
58             String JavaDoc.class);
59         this.createProperty("type", // NOI18N
60
TYPE,
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 setName(String JavaDoc value) {
74         this.setValue(NAME, value);
75     }
76
77     //
78
public String JavaDoc getName() {
79         return (String JavaDoc)this.getValue(NAME);
80     }
81
82     // This attribute is optional
83
public void setType(String JavaDoc value) {
84         this.setValue(TYPE, value);
85     }
86
87     //
88
public String JavaDoc getType() {
89         return (String JavaDoc)this.getValue(TYPE);
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 name
104
if (getName() == null) {
105             throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); // NOI18N
106
}
107         // Validating property type
108
if (getType() != 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("Name"); // NOI18N
119
str.append(indent+"\t"); // NOI18N
120
str.append("<"); // NOI18N
121
s = this.getName();
122         str.append((s==null?"null":s.trim())); // NOI18N
123
str.append(">\n"); // NOI18N
124
this.dumpAttributes(NAME, 0, str, indent);
125
126         str.append(indent);
127         str.append("Type"); // NOI18N
128
str.append(indent+"\t"); // NOI18N
129
str.append("<"); // NOI18N
130
s = this.getType();
131         str.append((s==null?"null":s.trim())); // NOI18N
132
str.append(">\n"); // NOI18N
133
this.dumpAttributes(TYPE, 0, str, indent);
134
135     }
136     public String JavaDoc dumpBeanNode(){
137         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
138         str.append("Argument\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 <!--
150   XML DTD for for constraints xml.
151   constraints.xml is used to specify provide information of the
152   Constraints to the Validation framework.
153  
154   $Revision: 1.3 $
155 -->
156
157
158 <!--
159 This is the root element.
160 -->
161 <!ELEMENT constraints (check-info*)>
162
163
164 <!--
165 This represents an information, about a particular Constraint.
166 Provides information of a Constraint represented by corresponding
167 <check> element in validation.xml.
168 Sub element <name> is used to link this element with the
169 corresponding <check> element in validation.xml.
170 -->
171 <!ELEMENT check-info (name, classname, arguments?)>
172
173
174 <!--
175 This element represents information of a Constraint class arguments.
176 Number of sub elements, <argument> should match with the number
177 of <parameter> sub elements, of corresponding <arguments> element
178 in validation.xml
179 -->
180 <!ELEMENT arguments (argument+)>
181
182
183 <!--
184 This element represents information of a single Constraint class
185 argument.
186 Sub elements <name> should match with the <name> sub element of
187 corresponding <parameter> element in constraints.xml
188 -->
189 <!ELEMENT argument (name, type?)>
190
191
192 <!--
193 Used in two elements <check-info> and <argument>
194 In <check-info>, it represents a Constraint name and is the linking
195 element between <check> element in validation.xml and <check-info>
196 element in constraints.xml.
197 In <argument>, it represents argument name and is the linking element
198 between <parameter> element in validation.xml and <argument> element
199 in constraints.xml.
200 -->
201 <!ELEMENT name (#PCDATA)>
202
203
204 <!--
205 This element represents Constraint class name.
206 Constraint class should provide the constructor with no arguments.
207 Constraint class should also provide the set* methods for all the
208 required arguments.
209 Constraint class is always created using default constructor and
210 then the arguments are set using set* methods.
211 -->
212 <!ELEMENT classname (#PCDATA)>
213
214
215 <!--
216 This element represents the type of an argument.
217 If not specified, it defaults to java.lang.String
218 -->
219 <!ELEMENT type (#PCDATA)>
220
221 */

222
Popular Tags