01: /*
02: * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
03: * Copyright (C) 2007 - Javolution (http://javolution.org/)
04: * All rights reserved.
05: *
06: * Permission to use, copy, modify, and distribute this software is
07: * freely granted, provided that this notice is preserved.
08: */
09: package javolution.xml;
10:
11: import j2me.io.Serializable;
12:
13: /**
14: * <p> This interface identifies classes supporting XML serialization
15: * (XML serialization is still possible for classes not implementing this
16: * interface through dynamic {@link XMLBinding} though).</p>
17: *
18: * <p> Typically, classes implementing this interface have a static
19: * {@link XMLFormat} holding their default XML representation.
20: * For example:[code]
21: * public final class Complex implements XMLSerializable {
22: *
23: * // Use the cartesien form for the default XML representation.
24: * static final XMLFormat<Complex> XML = new XMLFormat<Complex>(Complex.class) {
25: * public Complex newInstance(Class<Complex> cls, InputElement xml) throws XMLStreamException {
26: * return Complex.valueOf(xml.getAttribute("real", 0.0),
27: * xml.getAttribute("imaginary", 0.0));
28: * }
29: * public void write(Complex complex, OutputElement xml) throws XMLStreamException {
30: * xml.setAttribute("real", complex.getReal());
31: * xml.setAttribute("imaginary", complex.getImaginary());
32: * }
33: * public void read(InputElement xml, Complex complex) {
34: * // Immutable, deserialization occurs at creation, ref. newIntance(...)
35: * }
36: * };
37: * ...
38: * }[/code]</p>
39: *
40: * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
41: * @version 4.2, April 15, 2007
42: */
43: public interface XMLSerializable extends Serializable {
44:
45: // No method. Tagging interface.
46:
47: }
|