1 3 4 package org.enhydra.shark.wfxml.util; 5 6 import javax.xml.namespace.QName ; 7 import javax.xml.rpc.JAXRPCException ; 8 9 import org.apache.axis.description.TypeDesc; 10 import org.apache.axis.encoding.Serializer; 11 import org.apache.axis.encoding.ser.*; 12 import org.apache.axis.utils.*; 13 14 20 public class AltBeanSerializerFactory extends BaseSerializerFactory { 21 22 protected TypeDesc typeDesc = null; 23 protected BeanPropertyDescriptor[] propertyDescriptor = null; 24 25 public AltBeanSerializerFactory(Class javaType, QName xmlType) { 26 super(BeanSerializerShark.class, xmlType, javaType); 27 if (JavaUtils.isEnumClass(javaType)) { 30 serClass = EnumSerializer.class; 31 } 32 33 typeDesc = TypeDesc.getTypeDescForClass(javaType); 34 35 if (typeDesc != null) { 36 propertyDescriptor = typeDesc.getPropertyDescriptors(); 37 } else { 38 propertyDescriptor = BeanUtils.getPd(javaType, null); 39 } 40 } 41 42 public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) 43 throws JAXRPCException { 44 return (Serializer) super.getSerializerAs(mechanismType); 45 } 46 47 51 protected Serializer getGeneralPurpose(String mechanismType) { 52 if (javaType == null || xmlType == null) { 53 return super.getGeneralPurpose(mechanismType); 54 } 55 56 if (serClass == EnumSerializer.class) { 57 return super.getGeneralPurpose(mechanismType); 58 } 59 60 return new BeanSerializerShark(javaType, xmlType, typeDesc, 61 propertyDescriptor); 62 } 63 } 64 | Popular Tags |