44 * the Java object is not immediately serializable, this class will
45 * attempt to serialize all non-static members to permit the object
46 * state to be serialized.
47 * Static or transient fields cannot be serialized; an attempt to serialize
48 * them will result in a <code>SerialException</code> object being thrown.
49 *
50 * <h2> Thread safety </h2>
51 *
52 * A SerialJavaObject is not safe for use by multiple concurrent threads. If a
53 * SerialJavaObject is to be used by more than one thread then access to the
54 * SerialJavaObject should be controlled by appropriate synchronization.
55 *
56 * @author Jonathan Bruce
57 * @since 1.5
58 */
59 public class SerialJavaObject implements Serializable, Cloneable {
60
61 /**
62 * Placeholder for object to be serialized.
63 */
64 private Object obj;
65
66
67 /**
68 * Placeholder for all fields in the <code>JavaObject</code> being serialized.
69 */
70 private transient Field[] fields;
71
72 /**
73 * Constructor for <code>SerialJavaObject</code> helper class.
74 *
75 * @param obj the Java <code>Object</code> to be serialized
76 * @throws SerialException if the object is found not to be serializable
77 */
78 public SerialJavaObject(Object obj) throws SerialException {
79
80 // if any static fields are found, an exception
81 // should be thrown
82
83
|
44 * the Java object is not immediately serializable, this class will
45 * attempt to serialize all non-static members to permit the object
46 * state to be serialized.
47 * Static or transient fields cannot be serialized; an attempt to serialize
48 * them will result in a <code>SerialException</code> object being thrown.
49 *
50 * <h2> Thread safety </h2>
51 *
52 * A SerialJavaObject is not safe for use by multiple concurrent threads. If a
53 * SerialJavaObject is to be used by more than one thread then access to the
54 * SerialJavaObject should be controlled by appropriate synchronization.
55 *
56 * @author Jonathan Bruce
57 * @since 1.5
58 */
59 public class SerialJavaObject implements Serializable, Cloneable {
60
61 /**
62 * Placeholder for object to be serialized.
63 */
64 @SuppressWarnings("serial") // Not statically typed as Serializable
65 private Object obj;
66
67
68 /**
69 * Placeholder for all fields in the <code>JavaObject</code> being serialized.
70 */
71 private transient Field[] fields;
72
73 /**
74 * Constructor for <code>SerialJavaObject</code> helper class.
75 *
76 * @param obj the Java <code>Object</code> to be serialized
77 * @throws SerialException if the object is found not to be serializable
78 */
79 public SerialJavaObject(Object obj) throws SerialException {
80
81 // if any static fields are found, an exception
82 // should be thrown
83
84
|