KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > axis > client > ArrayTypeInfo


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.axis.client;
18
19 import javax.xml.namespace.QName JavaDoc;
20 import javax.xml.rpc.encoding.TypeMapping JavaDoc;
21 import javax.xml.rpc.encoding.SerializerFactory JavaDoc;
22 import javax.xml.rpc.encoding.DeserializerFactory JavaDoc;
23
24 import org.apache.axis.description.FieldDesc;
25 import org.apache.axis.encoding.ser.BaseSerializerFactory;
26 import org.apache.axis.encoding.ser.BaseDeserializerFactory;
27 import org.apache.axis.encoding.ser.ArraySerializerFactory;
28 import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
29
30 /**
31  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
32  */

33 public class ArrayTypeInfo extends TypeInfo {
34
35     private final QName JavaDoc componentType;
36     private final QName JavaDoc componentQName;
37
38     public ArrayTypeInfo(Class JavaDoc clazz,
39                          QName JavaDoc qName,
40                          Class JavaDoc serializerClass,
41                          Class JavaDoc deserializerClass,
42                          boolean canSearchParents,
43                          FieldDesc[] fields,
44                          QName JavaDoc componentType,
45                          QName JavaDoc componentQName) {
46         super(clazz, qName, serializerClass, deserializerClass, canSearchParents, fields);
47         this.componentType = componentType;
48         this.componentQName = componentQName;
49     }
50
51     public void register(TypeMapping JavaDoc typeMapping) {
52 // SerializerFactory ser = BaseSerializerFactory.createFactory(getSerFactoryClass(), getClazz(), getqName());
53
// ((ArraySerializerFactory)ser).setComponentType(componentType);
54
// ((ArraySerializerFactory)ser).setComponentQName(componentQName);
55
// DeserializerFactory deser = BaseDeserializerFactory.createFactory(getDeserFactoryClass(), getClazz(), getqName());
56
// ((ArrayDeserializerFactory)deser).setComponentType(componentType);
57

58         ArraySerializerFactory ser = new ArraySerializerFactory(componentType, componentQName);
59         ArrayDeserializerFactory deser = new ArrayDeserializerFactory();
60
61         typeMapping.register(getClazz(), getqName(), ser, deser);
62     }
63
64     public static class UpdatableArrayTypeInfo extends TypeInfo.UpdatableTypeInfo {
65         private QName JavaDoc componentType;
66         private QName JavaDoc componentQName;
67
68         public TypeInfo buildTypeInfo() {
69             if (null == clazz) {
70                 throw new IllegalStateException JavaDoc("clazz is null");
71             } else if (null == qName) {
72                 throw new IllegalStateException JavaDoc("qName is null");
73             } else if (null == serializerClass) {
74                 throw new IllegalStateException JavaDoc("serializerClass is null");
75             } else if (null == deserializerClass) {
76                 throw new IllegalStateException JavaDoc("deserializerClass is null");
77             } else if (null == fields) {
78                 throw new IllegalStateException JavaDoc("fields is null");
79             }
80             return new ArrayTypeInfo(clazz, qName, serializerClass, deserializerClass, canSearchParents, fields, componentType, componentQName);
81         }
82
83
84         public QName JavaDoc getComponentType() {
85             return componentType;
86         }
87
88         public QName JavaDoc getComponentQName() {
89             return componentQName;
90         }
91
92         public void setComponentType(QName JavaDoc componentType) {
93             this.componentType = componentType;
94         }
95
96         public void setComponentQName(QName JavaDoc componentQName) {
97             this.componentQName = componentQName;
98         }
99
100     }
101
102
103 }
104
Popular Tags