KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Axis" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation. For more
52  * information on the Apache Software Foundation, please see
53  * <http://www.apache.org/>.
54  */

55
56 package org.jboss.axis.types;
57
58 /**
59  * Custom class for supporting XSD schema
60  *
61  * @author Davanum Srinivas <dims@yahoo.com>
62  */

63 public class Schema
64 {
65    private org.jboss.axis.message.SOAPElementAxisImpl[] _any;
66    private org.jboss.axis.types.URI targetNamespace; // attribute
67
private org.jboss.axis.types.NormalizedString version; // attribute
68
private org.jboss.axis.types.Id id; // attribute
69

70    public Schema()
71    {
72    }
73
74    public org.jboss.axis.message.SOAPElementAxisImpl[] get_any()
75    {
76       return _any;
77    }
78
79    public void set_any(org.jboss.axis.message.SOAPElementAxisImpl[] _any)
80    {
81       this._any = _any;
82    }
83
84    public org.jboss.axis.types.URI getTargetNamespace()
85    {
86       return targetNamespace;
87    }
88
89    public void setTargetNamespace(org.jboss.axis.types.URI targetNamespace)
90    {
91       this.targetNamespace = targetNamespace;
92    }
93
94    public org.jboss.axis.types.NormalizedString getVersion()
95    {
96       return version;
97    }
98
99    public void setVersion(org.jboss.axis.types.NormalizedString version)
100    {
101       this.version = version;
102    }
103
104    public org.jboss.axis.types.Id getId()
105    {
106       return id;
107    }
108
109    public void setId(org.jboss.axis.types.Id id)
110    {
111       this.id = id;
112    }
113
114    private java.lang.Object JavaDoc __equalsCalc = null;
115
116    public synchronized boolean equals(java.lang.Object JavaDoc obj)
117    {
118       if (!(obj instanceof Schema)) return false;
119       Schema other = (Schema)obj;
120       if (obj == null) return false;
121       if (this == obj) return true;
122       if (__equalsCalc != null)
123       {
124          return (__equalsCalc == obj);
125       }
126       __equalsCalc = obj;
127       boolean _equals;
128       _equals = true &&
129               ((_any == null && other.get_any() == null) ||
130               (_any != null &&
131               java.util.Arrays.equals(_any, other.get_any()))) &&
132               ((targetNamespace == null && other.getTargetNamespace() == null) ||
133               (targetNamespace != null &&
134               targetNamespace.equals(other.getTargetNamespace()))) &&
135               ((version == null && other.getVersion() == null) ||
136               (version != null &&
137               version.equals(other.getVersion()))) &&
138               ((id == null && other.getId() == null) ||
139               (id != null &&
140               id.equals(other.getId())));
141       __equalsCalc = null;
142       return _equals;
143    }
144
145    private boolean __hashCodeCalc = false;
146
147    public synchronized int hashCode()
148    {
149       if (__hashCodeCalc)
150       {
151          return 0;
152       }
153       __hashCodeCalc = true;
154       int _hashCode = 1;
155       if (get_any() != null)
156       {
157          for (int i = 0;
158               i < java.lang.reflect.Array.getLength(get_any());
159               i++)
160          {
161             java.lang.Object JavaDoc obj = java.lang.reflect.Array.get(get_any(), i);
162             if (obj != null &&
163                     !obj.getClass().isArray())
164             {
165                _hashCode += obj.hashCode();
166             }
167          }
168       }
169       if (getTargetNamespace() != null)
170       {
171          _hashCode += getTargetNamespace().hashCode();
172       }
173       if (getVersion() != null)
174       {
175          _hashCode += getVersion().hashCode();
176       }
177       if (getId() != null)
178       {
179          _hashCode += getId().hashCode();
180       }
181       __hashCodeCalc = false;
182       return _hashCode;
183    }
184
185    // Type metadata
186
private static org.jboss.axis.description.TypeDesc typeDesc =
187            new org.jboss.axis.description.TypeDesc(Schema.class);
188
189    static
190    {
191       org.jboss.axis.description.FieldDesc field = new org.jboss.axis.description.AttributeDesc();
192       field.setFieldName("targetNamespace");
193       field.setXmlName(new javax.xml.namespace.QName JavaDoc("", "targetNamespace"));
194       field.setXmlType(new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema", "anyURI"));
195       typeDesc.addFieldDesc(field);
196       field = new org.jboss.axis.description.AttributeDesc();
197       field.setFieldName("version");
198       field.setXmlName(new javax.xml.namespace.QName JavaDoc("", "version"));
199       field.setXmlType(new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema", "normalizedString"));
200       typeDesc.addFieldDesc(field);
201       field = new org.jboss.axis.description.AttributeDesc();
202       field.setFieldName("id");
203       field.setXmlName(new javax.xml.namespace.QName JavaDoc("", "id"));
204       field.setXmlType(new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema", "ID"));
205       typeDesc.addFieldDesc(field);
206    }
207
208    /**
209     * Return type metadata object
210     */

211    public static org.jboss.axis.description.TypeDesc getTypeDesc()
212    {
213       return typeDesc;
214    }
215
216    /**
217     * Get Custom Serializer
218     */

219    public static org.jboss.axis.encoding.Serializer getSerializer(java.lang.String JavaDoc mechType,
220                                                                   java.lang.Class JavaDoc _javaType,
221                                                                   javax.xml.namespace.QName JavaDoc _xmlType)
222    {
223       return
224               new org.jboss.axis.encoding.ser.BeanSerializer(_javaType, _xmlType, typeDesc);
225    }
226
227    /**
228     * Get Custom Deserializer
229     */

230    public static org.jboss.axis.encoding.Deserializer getDeserializer(java.lang.String JavaDoc mechType,
231                                                                       java.lang.Class JavaDoc _javaType,
232                                                                       javax.xml.namespace.QName JavaDoc _xmlType)
233    {
234       return
235               new org.jboss.axis.encoding.ser.BeanDeserializer(_javaType, _xmlType, typeDesc);
236    }
237 }
238
Popular Tags