All Packages Class Hierarchy This Package Previous Next Index Home
Clases that implement Persistable must:
The PersistManager works by invoking each of these methods to define the structure of a class and to marshall the objects slots to/from the PersistManager. PersistManager's use PeristController to do the actual work.
You do not need to implement JOP.persist.Persistable to allow your class to be saved and restored. You can also create a custom marshall class or rely upon the automatic (native) marshalling.
The following is an example of the use of the Persistable interface:
package COM.mycompany ; import JOP.persist.Persistable ; import JOP.persist.PersistController ; public MyClass extends AnotherClass implements Persistable { private char c1 ; private String s2[] ; public MyClass() { c1 = 'A' ; s1 = new String[1] ; s1[0] = "Hello world" ; } public void defineObject( PersistController c ) throws Exception { super.defineObject( c ) ; c.defineSlot("COM.mycompany.MyClass", "c1", PersistController.TYPE_CHARACTER ) ; c.defineSlotArray("COM.mycompany.MyClass", "s2", PersistController.TYPE_STRING ) ; } public void streamOut( PersistController c ) throws Exception { super.streamOut( c ) ; c.put( "c1", c1 ) ; c.put( "s2", s2 ) ; } public void streamIn( PersistController c ) throws Exception { super.streamIn( c ) ; c1 = c.charValue( "c1" ) ; s2 = c.getStringArray( "s2" ) ; } }
public abstract void defineObject(PersistController c) throws Exception
Make sure the superclasses defineObject() method is called before the body of this method.
Make sure the class name passed to defineSlot is the fully qualified classname.
public abstract void streamOut(PersistController c) throws Exception
Call the superclasses streamOut() method before the bofy of this method.
public abstract void streamIn(PersistController c) throws Exception
Call the superclasses streamIn() method before the bofy of this method.
All Packages Class Hierarchy This Package Previous Next Index Home