Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/apache/axis/encoding/ser/ArraySerializerFactory.java


1   /*
2    * Copyright 2001-2005 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.encoding.ser;
18  
19  import org.apache.axis.Constants;
20  import org.apache.axis.encoding.Serializer;
21  
22  import javax.xml.namespace.QName;
23  
24  
25  /**
26   * SerializerFactory for arrays
27   *
28   * @author Rich Scheuerle <scheu@us.ibm.com>
29   */
30  public class ArraySerializerFactory extends BaseSerializerFactory {
31      public ArraySerializerFactory() {
32          this(Object[].class, Constants.SOAP_ARRAY);
33      }
34      public ArraySerializerFactory(Class javaType, QName xmlType) {
35          super(ArraySerializer.class, xmlType, javaType);
36      }
37  
38      private QName componentType = null;
39      private QName componentQName = null;
40  
41      public ArraySerializerFactory(QName componentType) {
42          super(ArraySerializer.class, Constants.SOAP_ARRAY, Object[].class);
43          this.componentType = componentType;
44      }
45  
46      public ArraySerializerFactory(QName componentType, QName componentQName) {
47          this(componentType);
48          this.componentQName = componentQName;
49      }
50  
51      /**
52       * @param componentQName The componentQName to set.
53       */
54      public void setComponentQName(QName componentQName) {
55          this.componentQName = componentQName;
56      }
57  
58      /**
59       * @param componentType The componentType to set.
60       */
61      public void setComponentType(QName componentType) {
62          this.componentType = componentType;
63      }
64  
65      /**
66       * @return Returns the componentQName.
67       */
68      public QName getComponentQName() {
69          return componentQName;
70      }
71      /**
72       * @return Returns the componentType.
73       */
74      public QName getComponentType() {
75          return componentType;
76      }
77      /**
78       * Obtains a serializer by invoking <constructor>(javaType, xmlType)
79       * on the serClass.
80       */
81      protected Serializer getGeneralPurpose(String mechanismType)
82      {
83          // Do something special only if we have an array component type
84  
85          if (componentType == null)
86              return super.getGeneralPurpose(mechanismType);
87          else
88              return new ArraySerializer(javaType, xmlType, componentType, componentQName);
89      }
90  }