1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package de.fu_berlin.ties.io;
23
24 /***
25 * Classes implementing this interface support serialization in a
26 * human-readable XML-based format.
27 *
28 * <p>Non-abstract implementations of this interface must support
29 * deserialization by providing a public constructor that accepts a
30 * {@link org.dom4j.Element} as single parameter that reads all
31 * relevant field values from the XML element. There is no way to enforce this
32 * convention (as interfaces cannot contain constructors), but
33 * deserialization via
34 * {@link de.fu_berlin.ties.io.ObjectElement#createObject(org.dom4j.Element,
35 * Class)} will fail when it is violated. Deserialization is based on a
36 * constructor instead of a "restore" or "init" method to allow the
37 * deserialization of immutable objects (whose fields cannot be changed after
38 * construction).
39 *
40 * @author Christian Siefkes
41 * @version $Revision: 1.5 $, $Date: 2006/10/21 16:04:22 $, $Author: siefkes $
42 */
43 public interface XMLStorable {
44
45 /***
46 * Stores all relevant fields of this object in an XML element for
47 * serialization. An equivalent object can be created by calling {@link
48 * de.fu_berlin.ties.io.ObjectElement#createObject(org.dom4j.Element,
49 * Class)} on the created element.
50 *
51 * @return the created XML element
52 */
53 ObjectElement toElement();
54
55 }