KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > validation > data > Parameters


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /**
21  * This generated bean class Parameters matches the schema element parameters
22  *
23  */

24
25 package org.netbeans.modules.j2ee.sun.validation.data;
26
27 import org.w3c.dom.*;
28 import org.netbeans.modules.schema2beans.*;
29 import java.beans.*;
30 import java.util.*;
31
32 // BEGIN_NOI18N
33

34 public class Parameters extends org.netbeans.modules.schema2beans.BaseBean
35 {
36
37     static Vector comparators = new Vector();
38
39     static public final String JavaDoc PARAMETER = "Parameter"; // NOI18N
40

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

152
153 /*
154         The following schema file has been used for generation:
155
156 <!--
157   XML DTD for for validation xml.
158   validation.xml is used to specify Constraints to be applied to
159   elements.
160  
161   $Revision: 1.2 $
162 -->
163
164
165 <!--
166 This is the root element
167 -->
168 <!ELEMENT validation (element*) >
169 <!ATTLIST validation
170         validate CDATA (true | false) "true">
171
172
173 <!--
174 This element represents, the set of Constraints to be applied to
175 the given element.
176 -->
177 <!ELEMENT element (name, check*)>
178
179
180 <!--
181 This element represents, a particular Constraint.
182 Note : Information about this Constraint must be provided through
183 corresponding <check-info> object in constraints.xml Sub element
184 <name> should match with <name> of corresponding <check-info>
185 element defined in constraints.xml.
186 -->
187 <!ELEMENT check (name, parameters?)>
188
189
190 <!--
191 This element represent, Constraint parameters.
192 Number of sub elements, <parameter> should match with the number
193 of <argument> sub elements, of corresponding <arguments> element
194 in constraints.xml
195 -->
196 <!ELEMENT parameters (parameter+)>
197
198
199 <!--
200 This element represents, a Constraint parameter.
201 Sub elements <name> should match with the <name> sub element of
202 corresponding <argument> element in constraints.xml
203 <value> could be one or more. In case of an variable array
204 argument, multiple <value> elements will be used.
205 Example : InConstraint
206 -->
207 <!ELEMENT parameter (name, value+)>
208
209
210 <!--
211 Used in elements : <element>, <check> and <parameter>
212 In <element> , it represents the name(xpath - complete absolute
213 name of an element(leaf).
214 In <check> , it represents name of a Constraint. This is the
215 linking element for <check> element in validation.xml and
216 <check-info> element in constraints.xml.
217 In <parameter>, it represents name of parameter. This is the
218 linking element for <parameter> element in validation.xml and
219 <argument> element in constraints.xml.
220 -->
221 <!ELEMENT name (#PCDATA)>
222
223
224 <!--
225 This element represents the value of a parameter.
226 -->
227 <!ELEMENT value (#PCDATA)>
228
229 */

230
Popular Tags