1 55 56 package org.jboss.axis.encoding.ser; 57 58 import org.jboss.axis.description.TypeDesc; 59 import org.jboss.axis.encoding.Serializer; 60 import org.jboss.axis.utils.BeanPropertyDescriptor; 61 import org.jboss.axis.utils.BeanUtils; 62 63 import javax.xml.namespace.QName ; 64 import javax.xml.rpc.JAXRPCException ; 65 66 71 public class BeanSerializerFactory extends BaseSerializerFactory 72 { 73 74 protected TypeDesc typeDesc = null; 75 protected BeanPropertyDescriptor[] propertyDescriptor = null; 76 77 public BeanSerializerFactory(Class javaType, QName xmlType) 78 { 79 super(BeanSerializer.class, xmlType, javaType); 80 81 typeDesc = TypeDesc.getTypeDescForClass(javaType); 82 83 if (typeDesc != null) 84 { 85 propertyDescriptor = typeDesc.getPropertyDescriptors(); 86 } 87 else 88 { 89 propertyDescriptor = BeanUtils.getPd(javaType, null); 90 } 91 } 92 93 public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) 94 throws JAXRPCException 95 { 96 return (Serializer)super.getSerializerAs(mechanismType); 97 } 98 99 103 protected Serializer getGeneralPurpose(String mechanismType) 104 { 105 if (javaType == null || xmlType == null) 106 { 107 return super.getGeneralPurpose(mechanismType); 108 } 109 110 if (serClass == EnumSerializer.class) 111 { 112 return super.getGeneralPurpose(mechanismType); 113 } 114 115 return new BeanSerializer(javaType, xmlType, typeDesc, propertyDescriptor); 116 } 117 } 118 | Popular Tags |