Instances of your application classes must implement the interface
JobCapable
. Persistence in JOB is
controlled by a contract defined between this interface and the
ObjectInput/ObjectOutput interfaces.
Instances of the latter interfaces are
provided by JOB implementation. The ObjectInput instance
refreshes your JOB capable instances with values read from JOB. The
ObjectOutput instance stores values of your JOBCapable instances in JOB.
The contract determines the interactions in a similar way as the Serializable
contract.
For this purpose, JOB capable classes are required to implement two private
methods having the following signatures:
private void writeObject(java.io.ObjectOutput out) throws java.io.IOException
private void readObject(java.io.ObjectInput in) throws java.io.IOException,
ClassNotFoundException
The implementation of method writeObject
is intended to
write fields of the declaring class to the ObjectOutput instance. As an
effect, values of these fields are stored in JOB. The implementation of
method readObject
is intended to assign values to fields of the
declaring class, which are read from an ObjectOutput instance.
As an effect, these values are retrieved from JOB.
Unlike the Serializable
contract in JDK, the JOBCapable contract does
not support a default mechanism writing and reading fields. If your
classes implement the interface JobCapable
but do not implement
the two methods above, then no fields are written/read to/from JOB. Instead,
JOB exceptions are thrown.
Note : JobCapable instances are required to have a public no-arg constructor.