KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > types > Schema


1 /*
2  * Copyright 2001-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.axis.types;
18
19 /**
20  * Custom class for supporting XSD schema
21  *
22  * @author Davanum Srinivas <dims@yahoo.com>
23  */

24 public class Schema implements java.io.Serializable JavaDoc {
25     private org.apache.axis.message.MessageElement[] _any;
26     private org.apache.axis.types.URI targetNamespace; // attribute
27
private org.apache.axis.types.NormalizedString version; // attribute
28
private org.apache.axis.types.Id id; // attribute
29

30     public Schema() {
31     }
32
33     public org.apache.axis.message.MessageElement[] get_any() {
34         return _any;
35     }
36
37     public void set_any(org.apache.axis.message.MessageElement[] _any) {
38         this._any = _any;
39     }
40
41     public org.apache.axis.types.URI getTargetNamespace() {
42         return targetNamespace;
43     }
44
45     public void setTargetNamespace(org.apache.axis.types.URI targetNamespace) {
46         this.targetNamespace = targetNamespace;
47     }
48
49     public org.apache.axis.types.NormalizedString getVersion() {
50         return version;
51     }
52
53     public void setVersion(org.apache.axis.types.NormalizedString version) {
54         this.version = version;
55     }
56
57     public org.apache.axis.types.Id getId() {
58         return id;
59     }
60
61     public void setId(org.apache.axis.types.Id id) {
62         this.id = id;
63     }
64
65     private java.lang.Object JavaDoc __equalsCalc = null;
66
67     public synchronized boolean equals(java.lang.Object JavaDoc obj) {
68         if (!(obj instanceof Schema)) return false;
69         Schema other = (Schema) obj;
70         if (obj == null) return false;
71         if (this == obj) return true;
72         if (__equalsCalc != null) {
73             return (__equalsCalc == obj);
74         }
75         __equalsCalc = obj;
76         boolean _equals;
77         _equals = true &&
78                 ((_any == null && other.get_any() == null) ||
79                 (_any != null &&
80                 java.util.Arrays.equals(_any, other.get_any()))) &&
81                 ((targetNamespace == null && other.getTargetNamespace() == null) ||
82                 (targetNamespace != null &&
83                 targetNamespace.equals(other.getTargetNamespace()))) &&
84                 ((version == null && other.getVersion() == null) ||
85                 (version != null &&
86                 version.equals(other.getVersion()))) &&
87                 ((id == null && other.getId() == null) ||
88                 (id != null &&
89                 id.equals(other.getId())));
90         __equalsCalc = null;
91         return _equals;
92     }
93
94     private boolean __hashCodeCalc = false;
95
96     public synchronized int hashCode() {
97         if (__hashCodeCalc) {
98             return 0;
99         }
100         __hashCodeCalc = true;
101         int _hashCode = 1;
102         if (get_any() != null) {
103             for (int i = 0;
104                  i < java.lang.reflect.Array.getLength(get_any());
105                  i++) {
106                 java.lang.Object JavaDoc obj = java.lang.reflect.Array.get(get_any(), i);
107                 if (obj != null &&
108                         !obj.getClass().isArray()) {
109                     _hashCode += obj.hashCode();
110                 }
111             }
112         }
113         if (getTargetNamespace() != null) {
114             _hashCode += getTargetNamespace().hashCode();
115         }
116         if (getVersion() != null) {
117             _hashCode += getVersion().hashCode();
118         }
119         if (getId() != null) {
120             _hashCode += getId().hashCode();
121         }
122         __hashCodeCalc = false;
123         return _hashCode;
124     }
125
126     // Type metadata
127
private static org.apache.axis.description.TypeDesc typeDesc =
128             new org.apache.axis.description.TypeDesc(Schema.class);
129
130     static {
131         org.apache.axis.description.FieldDesc field = new org.apache.axis.description.AttributeDesc();
132         field.setFieldName("targetNamespace");
133         field.setXmlName(new javax.xml.namespace.QName JavaDoc("", "targetNamespace"));
134         field.setXmlType(new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema", "anyURI"));
135         typeDesc.addFieldDesc(field);
136         field = new org.apache.axis.description.AttributeDesc();
137         field.setFieldName("version");
138         field.setXmlName(new javax.xml.namespace.QName JavaDoc("", "version"));
139         field.setXmlType(new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema", "normalizedString"));
140         typeDesc.addFieldDesc(field);
141         field = new org.apache.axis.description.AttributeDesc();
142         field.setFieldName("id");
143         field.setXmlName(new javax.xml.namespace.QName JavaDoc("", "id"));
144         field.setXmlType(new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema", "ID"));
145         typeDesc.addFieldDesc(field);
146     }
147
148     /**
149      * Return type metadata object
150      */

151     public static org.apache.axis.description.TypeDesc getTypeDesc() {
152         return typeDesc;
153     }
154
155     /**
156      * Get Custom Serializer
157      */

158     public static org.apache.axis.encoding.Serializer getSerializer(
159             java.lang.String JavaDoc mechType,
160             java.lang.Class JavaDoc _javaType,
161             javax.xml.namespace.QName JavaDoc _xmlType) {
162         return
163                 new org.apache.axis.encoding.ser.BeanSerializer(
164                         _javaType, _xmlType, typeDesc);
165     }
166
167     /**
168      * Get Custom Deserializer
169      */

170     public static org.apache.axis.encoding.Deserializer getDeserializer(
171             java.lang.String JavaDoc mechType,
172             java.lang.Class JavaDoc _javaType,
173             javax.xml.namespace.QName JavaDoc _xmlType) {
174         return
175                 new org.apache.axis.encoding.ser.BeanDeserializer(
176                         _javaType, _xmlType, typeDesc);
177     }
178 }
179
Popular Tags