1 package tableapp.business.axis; 2 3 11 import org.apache.axis.Constants; 12 import org.apache.axis.encoding.SerializationContext; 13 import org.apache.axis.encoding.Serializer; 14 import org.apache.axis.wsdl.fromJava.Types; 15 import org.w3c.dom.Element ; 16 import org.xml.sax.Attributes ; 17 import java.util.Date ; 18 import javax.xml.namespace.QName ; 19 import java.io.IOException ; 20 import tableapp.spec.Access; 21 22 public class AccessSer 23 implements Serializer { 24 public static final String INTMEMBER = "noAccesses"; 25 public static final String DATEMEMBER = "sDate"; 26 public static final QName myTypeQName = new QName ("typeNS", "Access"); 27 public void serialize(QName name, Attributes attributes, 28 Object value, SerializationContext context) throws 29 IOException { 30 if (! (value instanceof Access)) 31 throw new IOException ("Can't serialize a " + value.getClass().getName() + 32 " with a AccessSer."); 33 Access data = (Access) value; 34 35 context.startElement(name, attributes); 36 context.serialize(new QName ("", INTMEMBER), null, 37 new Integer (data.getNoAccesses())); 38 context.serialize(new QName ("", DATEMEMBER), null, data.getDate()); 39 context.endElement(); 40 } 41 42 public String getMechanismType() { 43 return Constants.AXIS_SAX; 44 } 45 46 public Element writeSchema(Class javaType, Types types) throws Exception { 47 return null; 48 } 49 50 } | Popular Tags |