View Javadoc

1   /*
2    * Copyright 2004,2007 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.commons.schema;
18  
19  import org.apache.ws.commons.schema.constants.Constants;
20  
21  import javax.xml.namespace.QName;
22  
23  
24  /**
25   * The base class for all simple types and complex types.
26   */
27  
28  public class XmlSchemaType extends XmlSchemaAnnotated {
29  
30      Object baseSchemaType;
31      XmlSchemaDatatype dataType;
32      XmlSchemaDerivationMethod deriveBy, finalDerivation, finalResolved;
33      boolean isMixed;
34  
35      // name of the type
36      String name;
37  
38      XmlSchema schema;
39  
40      /**
41       * Creates new XmlSchemaType
42       */
43      public XmlSchemaType(XmlSchema schema) {
44          this.schema = schema;
45          finalDerivation = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE);
46      }
47  
48      public Object getBaseSchemaType() {
49          return baseSchemaType;
50      }
51  
52      public XmlSchemaDatatype getDataType() {
53          return dataType;
54      }
55  
56      public XmlSchemaDerivationMethod getDeriveBy() {
57          return deriveBy;
58      }
59  
60      public XmlSchemaDerivationMethod getFinal() {
61          return finalDerivation;
62      }
63  
64      public void setFinal(XmlSchemaDerivationMethod finalDerivation) {
65          this.finalDerivation = finalDerivation;
66      }
67  
68      public XmlSchemaDerivationMethod getFinalResolved() {
69          return finalResolved;
70      }
71  
72      public boolean isMixed() {
73          return isMixed;
74      }
75  
76      public void setMixed(boolean isMixed) {
77          this.isMixed = isMixed;
78      }
79  
80      public String getName() {
81          return name;
82      }
83  
84      public void setName(String name) {
85          this.name = name;
86      }
87  
88      public QName getQName() {
89          if(name == null) {
90              return null;
91          }
92          return new QName(schema.logicalTargetNamespace, name);
93      }
94  }