KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > webservices > builder > SchemaTypeKey


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

17 package org.apache.geronimo.webservices.builder;
18
19 import javax.xml.namespace.QName JavaDoc;
20
21 /**
22  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
23  */

24 public final class SchemaTypeKey {
25     public static final String JavaDoc QNAME_SCOPE_COMPLEX_TYPE = "complexType";
26     public static final String JavaDoc QNAME_SCOPE_SIMPLE_TYPE = "simpleType";
27     public static final String JavaDoc QNAME_SCOPE_ELEMENT = "element";
28
29     private final QName JavaDoc qName;
30     private final String JavaDoc qNameScope;
31     private final boolean isElement;
32     private final boolean isSimpleType;
33     private final boolean isAnonymous;
34
35     private final QName JavaDoc elementQName;
36
37
38     public SchemaTypeKey(QName JavaDoc qName, boolean element, boolean isSimpleType, boolean anonymous, QName JavaDoc elementQName) {
39         assert qName != null;
40         this.qName = qName;
41         isElement = element;
42         this.isSimpleType = isSimpleType;
43         isAnonymous = anonymous;
44         if (isElement) {
45             qNameScope = QNAME_SCOPE_ELEMENT;
46         } else if (isSimpleType) {
47             qNameScope = QNAME_SCOPE_SIMPLE_TYPE;
48         } else {
49             qNameScope = QNAME_SCOPE_COMPLEX_TYPE;
50         }
51         this.elementQName = elementQName;
52     }
53
54     public QName JavaDoc getqName() {
55         return qName;
56     }
57
58     public boolean isElement() {
59         return isElement;
60     }
61
62     public boolean isSimpleType() {
63         return isSimpleType;
64     }
65
66     public boolean isAnonymous() {
67         return isAnonymous;
68     }
69
70     public String JavaDoc getqNameScope() {
71         return qNameScope;
72     }
73
74     public QName JavaDoc getElementQName() {
75         return elementQName;
76     }
77
78     public int hashCode() {
79         return qName.hashCode();
80     }
81
82     public boolean equals(Object JavaDoc other) {
83         if (!(other instanceof SchemaTypeKey)) {
84             return false;
85         }
86         SchemaTypeKey key = (SchemaTypeKey) other;
87         return isElement == key.isElement && isSimpleType == key.isSimpleType && isAnonymous == key.isAnonymous && qName.equals(key.qName);
88     }
89
90     public String JavaDoc toString() {
91         StringBuffer JavaDoc buf = new StringBuffer JavaDoc("\nSchemaTypeKey: scope: ").append(qNameScope);
92         buf.append(" isElement: ").append(isElement);
93         buf.append(" isAnonymous: ").append(isAnonymous);
94         buf.append(" isSimpleType: ").append(isSimpleType);
95         buf.append("\n QName: ").append(qName).append("\n");
96         return buf.toString();
97     }
98
99
100 }
101
Popular Tags