KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > xs > xml > impl > XsTLocalAllElementImpl


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */

17 package org.apache.ws.jaxme.xs.xml.impl;
18
19 import org.apache.ws.jaxme.xs.xml.XsObject;
20
21
22 /**
23  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
24  */

25 public class XsTLocalAllElementImpl extends XsTLocalElementImpl {
26   protected XsTLocalAllElementImpl(XsObject pParent) {
27     super(pParent);
28   }
29
30   public void setMaxOccurs(String JavaDoc pValue) {
31     boolean valid = !"unbounded".equals(pValue);
32     if (valid) {
33       try {
34         int i = Integer.parseInt(pValue);
35         valid = i == 0 || i == 1;
36       } catch (Exception JavaDoc e) {
37         valid = false;
38       }
39     }
40     if (!valid) {
41       throw new IllegalArgumentException JavaDoc("Invalid value for 'maxOccurs': " + pValue + "; must be 0 or 1");
42     }
43     super.setMaxOccurs(pValue);
44   }
45   public void setMinOccurs(int pValue) {
46     if (pValue != 0 && pValue != 1) {
47       throw new IllegalArgumentException JavaDoc("Invalid value for 'minOccurs': " + pValue + "; must be 0 or 1");
48     }
49     super.setMinOccurs(pValue);
50   }
51 }
52
Popular Tags