1 55 56 package org.jboss.axis.encoding.ser; 57 58 import org.jboss.axis.utils.JavaUtils; 59 60 import javax.xml.namespace.QName ; 61 import javax.xml.rpc.JAXRPCException ; 62 import java.lang.reflect.Constructor ; 63 64 73 public class SimpleDeserializerFactory extends BaseDeserializerFactory 74 { 75 76 private Constructor constructor = null; 77 78 82 public SimpleDeserializerFactory(Class javaType, QName xmlType) 83 { 84 super(SimpleDeserializer.class, xmlType, javaType); 85 try 86 { 87 if (!javaType.isPrimitive()) 88 { 89 constructor = 90 javaType.getDeclaredConstructor(new Class []{String .class}); 91 } 92 else 93 { 94 Class wrapper = JavaUtils.getWrapperClass(javaType); 95 if (wrapper != null) 96 constructor = 97 wrapper.getDeclaredConstructor(new Class []{String .class}); 98 } 99 } 100 catch (java.lang.NoSuchMethodException e) 101 { 102 throw new IllegalArgumentException (e.toString()); 103 } 104 } 105 106 110 public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) 111 throws JAXRPCException 112 { 113 if (javaType == java.lang.Object .class) 114 { 115 return null; 116 } 117 SimpleDeserializer deser = (SimpleDeserializer)super.getDeserializerAs(mechanismType); 118 if (deser != null) 119 deser.setConstructor(constructor); 120 return deser; 121 } 122 123 } 124 | Popular Tags |