KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > tableapp > business > axis > AccessSer


1 package tableapp.business.axis;
2
3 /**
4  * <p>Title: </p>
5  * <p>Description: </p>
6  * <p>Copyright: Copyright (c) 2005</p>
7  * <p>Company: </p>
8  * @author not attributable
9  * @version 1.0
10  */

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 JavaDoc;
16 import org.xml.sax.Attributes JavaDoc;
17 import java.util.Date JavaDoc;
18 import javax.xml.namespace.QName JavaDoc;
19 import java.io.IOException JavaDoc;
20 import tableapp.spec.Access;
21
22 public class AccessSer
23     implements Serializer {
24   public static final String JavaDoc INTMEMBER = "noAccesses";
25   public static final String JavaDoc DATEMEMBER = "sDate";
26   public static final QName JavaDoc myTypeQName = new QName JavaDoc("typeNS", "Access");
27   public void serialize(QName JavaDoc name, Attributes JavaDoc attributes,
28                         Object JavaDoc value, SerializationContext context) throws
29       IOException JavaDoc {
30     if (! (value instanceof Access))
31       throw new IOException JavaDoc("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 JavaDoc("", INTMEMBER), null,
37                       new Integer JavaDoc(data.getNoAccesses()));
38     context.serialize(new QName JavaDoc("", DATEMEMBER), null, data.getDate());
39     context.endElement();
40   }
41
42   public String JavaDoc getMechanismType() {
43     return Constants.AXIS_SAX;
44   }
45
46   public Element JavaDoc writeSchema(Class JavaDoc javaType, Types types) throws Exception JavaDoc {
47     return null;
48   }
49
50 }
Popular Tags