| Home >> All >> org >> apache >> axis >> encoding >> [ ser Javadoc ] |
Source code: org/apache/axis/encoding/ser/JAFDataHandlerSerializerFactory.java
1 /* 2 * Copyright 2001-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 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 /** 27 * A JAFDataHandlerSerializer Factory 28 * 29 * @author Rich Scheuerle (scheu@us.ibm.com) 30 */ 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 } // getSerializerClass 62 }