KickJava   Java API By Example, From Geeks To Geeks.

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


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 Arguments matches the schema element arguments
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 Arguments extends org.netbeans.modules.schema2beans.BaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc ARGUMENT = "Argument"; // NOI18N
45

46     public Arguments() {
47         this(Common.USE_DEFAULT_VALUES);
48     }
49
50     public Arguments(int options)
51     {
52         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
53         // Properties (see root bean comments for the bean graph)
54
this.createProperty("argument", // NOI18N
55
ARGUMENT,
56             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
57             Argument.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 an array containing at least one element
68
public void setArgument(int index, Argument value) {
69         this.setValue(ARGUMENT, index, value);
70     }
71
72     //
73
public Argument getArgument(int index) {
74         return (Argument)this.getValue(ARGUMENT, index);
75     }
76
77     // This attribute is an array containing at least one element
78
public void setArgument(Argument[] value) {
79         this.setValue(ARGUMENT, value);
80     }
81
82     //
83
public Argument[] getArgument() {
84         return (Argument[])this.getValues(ARGUMENT);
85     }
86
87     // Return the number of properties
88
public int sizeArgument() {
89         return this.size(ARGUMENT);
90     }
91
92     // Add a new element returning its index in the list
93
public int addArgument(com.sun.enterprise.tools.common.validation.constraints.data.Argument value) {
94         return this.addValue(ARGUMENT, value);
95     }
96
97     //
98
// Remove an element using its reference
99
// Returns the index the element had in the list
100
//
101
public int removeArgument(com.sun.enterprise.tools.common.validation.constraints.data.Argument value) {
102         return this.removeValue(ARGUMENT, value);
103     }
104
105     //
106
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
107         comparators.add(c);
108     }
109
110     //
111
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
112         comparators.remove(c);
113     }
114     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
115         boolean restrictionFailure = false;
116         // Validating property argument
117
if (sizeArgument() == 0) {
118             throw new org.netbeans.modules.schema2beans.ValidateException("sizeArgument() == 0", "argument", this); // NOI18N
119
}
120         for (int _index = 0; _index < sizeArgument(); ++_index) {
121             com.sun.enterprise.tools.common.validation.constraints.data.Argument element = getArgument(_index);
122             if (element != null) {
123                 element.validate();
124             }
125         }
126     }
127
128     // Dump the content of this bean returning it as a String
129
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
130         String JavaDoc s;
131         Object JavaDoc o;
132         org.netbeans.modules.schema2beans.BaseBean n;
133         str.append(indent);
134         str.append("Argument["+this.sizeArgument()+"]"); // NOI18N
135
for(int i=0; i<this.sizeArgument(); i++)
136         {
137             str.append(indent+"\t");
138             str.append("#"+i+":");
139             n = (org.netbeans.modules.schema2beans.BaseBean) this.getArgument(i);
140             if (n != null)
141                 n.dump(str, indent + "\t"); // NOI18N
142
else
143                 str.append(indent+"\tnull"); // NOI18N
144
this.dumpAttributes(ARGUMENT, i, str, indent);
145         }
146
147     }
148     public String JavaDoc dumpBeanNode(){
149         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
150         str.append("Arguments\n"); // NOI18N
151
this.dump(str, "\n "); // NOI18N
152
return str.toString();
153     }}
154
155 // END_NOI18N
156

157
158 /*
159         The following schema file has been used for generation:
160
161 <!--
162   XML DTD for for constraints xml.
163   constraints.xml is used to specify provide information of the
164   Constraints to the Validation framework.
165  
166   $Revision: 1.3 $
167 -->
168
169
170 <!--
171 This is the root element.
172 -->
173 <!ELEMENT constraints (check-info*)>
174
175
176 <!--
177 This represents an information, about a particular Constraint.
178 Provides information of a Constraint represented by corresponding
179 <check> element in validation.xml.
180 Sub element <name> is used to link this element with the
181 corresponding <check> element in validation.xml.
182 -->
183 <!ELEMENT check-info (name, classname, arguments?)>
184
185
186 <!--
187 This element represents information of a Constraint class arguments.
188 Number of sub elements, <argument> should match with the number
189 of <parameter> sub elements, of corresponding <arguments> element
190 in validation.xml
191 -->
192 <!ELEMENT arguments (argument+)>
193
194
195 <!--
196 This element represents information of a single Constraint class
197 argument.
198 Sub elements <name> should match with the <name> sub element of
199 corresponding <parameter> element in constraints.xml
200 -->
201 <!ELEMENT argument (name, type?)>
202
203
204 <!--
205 Used in two elements <check-info> and <argument>
206 In <check-info>, it represents a Constraint name and is the linking
207 element between <check> element in validation.xml and <check-info>
208 element in constraints.xml.
209 In <argument>, it represents argument name and is the linking element
210 between <parameter> element in validation.xml and <argument> element
211 in constraints.xml.
212 -->
213 <!ELEMENT name (#PCDATA)>
214
215
216 <!--
217 This element represents Constraint class name.
218 Constraint class should provide the constructor with no arguments.
219 Constraint class should also provide the set* methods for all the
220 required arguments.
221 Constraint class is always created using default constructor and
222 then the arguments are set using set* methods.
223 -->
224 <!ELEMENT classname (#PCDATA)>
225
226
227 <!--
228 This element represents the type of an argument.
229 If not specified, it defaults to java.lang.String
230 -->
231 <!ELEMENT type (#PCDATA)>
232
233 */

234
Popular Tags