1 16 17 package org.apache.axis.encoding.ser; 18 import org.apache.axis.utils.JavaUtils; 19 20 import javax.xml.namespace.QName ; 21 import javax.xml.rpc.JAXRPCException ; 22 23 import java.io.ObjectStreamException ; 24 import java.lang.reflect.Constructor ; 25 26 35 public class SimpleListDeserializerFactory extends BaseDeserializerFactory { 36 37 private static final Class [] STRING_CLASS = 38 new Class [] {String .class}; 39 40 private final Class clazzType; 41 private transient Constructor constructor = null; 42 46 public SimpleListDeserializerFactory(Class javaType, QName xmlType) { 47 super(SimpleListDeserializer.class, xmlType, javaType.getComponentType()); 48 clazzType = javaType; 49 Class componentType = javaType.getComponentType(); 50 try { 51 if (!componentType.isPrimitive()) { 52 constructor = 53 componentType.getDeclaredConstructor(STRING_CLASS); 54 } 55 else { 56 Class wrapper = JavaUtils.getWrapperClass(componentType); 57 if (wrapper != null) 58 constructor = 59 wrapper.getDeclaredConstructor(STRING_CLASS); 60 } 61 } catch (java.lang.NoSuchMethodException e) { 62 throw new IllegalArgumentException (e.toString()); 63 } 64 } 65 66 70 public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) 71 throws JAXRPCException { 72 if (javaType == java.lang.Object .class) { 73 return null; 74 } 75 SimpleListDeserializer deser = (SimpleListDeserializer) super.getDeserializerAs(mechanismType); 76 if (deser != null) 77 deser.setConstructor(constructor); 78 return deser; 79 } 80 81 private Object readResolve() throws ObjectStreamException { 82 return new SimpleListDeserializerFactory(clazzType, xmlType); 83 } 84 } 85 | Popular Tags |