Interface JOP.persist.PersistMarshall
All Packages  Class Hierarchy  This Package  Previous  Next  Index  Home

Interface JOP.persist.PersistMarshall

public interface PersistMarshall
extends Object
extends Persistable
A class implementation that supports this interface can act as a custom marshaller for an object. This is useful where the source to the object is not available, where you don't want to modify the source or where native methods are not suitable.

The PersistMarshall interface also allows an object that naturally consists of an array of instances to be marshalled and stored efficiently. Examples of this include Hashtables, Vectors and Arrays.

A custom marshaller class must:

  1. Implement this interface
  2. Have an empty, public constructor
  3. Have a name the same as the class that it is marshalling with thr suffix '_JOP'.
  4. Must appear in a package that is the same relationship to JOP.persistmarshall as the original object is to CLASSPATH (eg the custom marshall class for 'java.lang.String' is 'JOP.persistmarshall.java.lang.String_JOP')

Method Index

 o canModify()
Returns TRUE if the object can be modified by the custom marshaller after it has been created and returned by 'getObject()'.
 o getObject()
Invoked by the PersistManager to retrieve an object that was created by the customer marshaller.
 o setObject(Object)
Called by the PersistManager to initialise the customer marshaller when reading an object where the object already exists.

Methods

 o setObject
  public abstract void setObject(Object o) throws Exception
Called by the PersistManager to initialise the customer marshaller when reading an object where the object already exists.

The customer marshaller must reset and overwrite the slot values of the existing object.

Parameters:
o - an existing object
 o getObject
  public abstract Object getObject() throws Exception
Invoked by the PersistManager to retrieve an object that was created by the customer marshaller. Called after initInput(). Can also be called after initInput(o) in which case the original object should be returned.
 o canModify
  public abstract boolean canModify()
Returns TRUE if the object can be modified by the custom marshaller after it has been created and returned by 'getObject()'. This method is used to choose the order in which the 'streamIn()' method is invoked, ie before or after 'getObject()'.

If the object to be marhshalled can't be modified once created AND the object references other objects then errors will occur. In this case you should not use the custom marshall, but rather use either Persistable or a native marshall.


All Packages  Class Hierarchy  This Package  Previous  Next  Index  Home