KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > xs > impl > XSEnumerationImpl


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.impl;
18
19 import org.apache.ws.jaxme.xs.XSAnnotation;
20 import org.apache.ws.jaxme.xs.XSEnumeration;
21 import org.apache.ws.jaxme.xs.XSObject;
22 import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
23 import org.apache.ws.jaxme.xs.xml.XsEEnumeration;
24 import org.xml.sax.SAXException JavaDoc;
25
26
27 /** <p>Implementation of an <code>xs:enumeration</code> facet, as specified
28  * by {@link org.apache.ws.jaxme.xs.XSEnumeration}.</p>
29  *
30  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
31  */

32 public class XSEnumerationImpl extends XSObjectImpl implements XSEnumeration {
33   private final XSAnnotation[] annotations;
34
35   /** <p>Creates a new instance of XSEnumerationImpl.java.</p>
36    */

37   public XSEnumerationImpl(XSObject pParent, XsEEnumeration pBaseEnumeration) throws SAXException JavaDoc {
38     super(pParent, pBaseEnumeration);
39     if (pBaseEnumeration.getValue() == null) {
40       throw new NullPointerException JavaDoc("Missing attribute: 'value'");
41     }
42     XsEAnnotation xsAnnotation = pBaseEnumeration.getAnnotation();
43     if (xsAnnotation == null) {
44       annotations = new XSAnnotation[0];
45     } else {
46       annotations = new XSAnnotation[]{getXSSchema().getXSObjectFactory().newXSAnnotation(this, xsAnnotation)};
47     }
48   }
49
50   public String JavaDoc getValue() { return ((XsEEnumeration) getXsObject()).getValue(); }
51
52   public XSAnnotation[] getAnnotations() { return annotations; }
53 }
54
Popular Tags