1 16 17 package org.apache.axis.encoding.ser; 18 19 import org.apache.axis.attachments.OctetStream; 20 21 import javax.mail.internet.MimeMultipart ; 22 import javax.xml.namespace.QName ; 23 import javax.xml.transform.Source ; 24 import java.awt.*; 25 26 31 public class JAFDataHandlerSerializerFactory extends BaseSerializerFactory { 32 33 public JAFDataHandlerSerializerFactory(Class javaType, QName xmlType) { 34 super(getSerializerClass(javaType, xmlType), xmlType, javaType); 35 } 36 public JAFDataHandlerSerializerFactory() { 37 super(JAFDataHandlerSerializer.class); 38 } 39 40 private static Class getSerializerClass(Class javaType, QName xmlType) { 41 Class ser; 42 if (Image.class.isAssignableFrom(javaType)) { 43 ser = ImageDataHandlerSerializer.class; 44 } 45 else if (String .class.isAssignableFrom(javaType)) { 46 ser = PlainTextDataHandlerSerializer.class; 47 } 48 else if (Source .class.isAssignableFrom(javaType)) { 49 ser = SourceDataHandlerSerializer.class; 50 } 51 else if (MimeMultipart .class.isAssignableFrom(javaType)) { 52 ser = MimeMultipartDataHandlerSerializer.class; 53 } 54 else if (OctetStream.class.isAssignableFrom(javaType)) { 55 ser = OctetStreamDataHandlerSerializer.class; 56 } 57 else { 58 ser = JAFDataHandlerSerializer.class; 59 } 60 return ser; 61 } } 63 | Popular Tags |