1 55 56 package org.jboss.axis.encoding.ser; 57 58 import org.jboss.axis.attachments.OctetStream; 59 60 import javax.mail.internet.MimeMultipart ; 61 import javax.xml.namespace.QName ; 62 import javax.xml.transform.Source ; 63 import java.awt.*; 64 65 70 public class JAFDataHandlerSerializerFactory extends BaseSerializerFactory 71 { 72 73 public JAFDataHandlerSerializerFactory(Class javaType, QName xmlType) 74 { 75 super(getSerializerClass(javaType, xmlType), xmlType, javaType); 76 } 77 78 public JAFDataHandlerSerializerFactory() 79 { 80 super(JAFDataHandlerSerializer.class); 81 } 82 83 private static Class getSerializerClass(Class javaType, QName xmlType) 84 { 85 Class ser; 86 if (Image.class.isAssignableFrom(javaType)) 87 { 88 ser = ImageDataHandlerSerializer.class; 89 } 90 else if (String .class.isAssignableFrom(javaType)) 91 { 92 ser = PlainTextDataHandlerSerializer.class; 93 } 94 else if (Source .class.isAssignableFrom(javaType)) 95 { 96 ser = SourceDataHandlerSerializer.class; 97 } 98 else if (MimeMultipart .class.isAssignableFrom(javaType)) 99 { 100 ser = MimeMultipartDataHandlerSerializer.class; 101 } 102 else if (OctetStream.class.isAssignableFrom(javaType)) 103 { 104 ser = OctetStreamDataHandlerSerializer.class; 105 } 106 else 107 { 108 ser = JAFDataHandlerSerializer.class; 109 } 110 return ser; 111 } } 113 | Popular Tags |