MicroStrategy ONE

Persistable

Many objects in the Web Beans API and the Web Objects API implement the Persistable interface. This interface simplifies the process of maintaining access to objects whose properties have already been set and might be reused at various times throughout the life of a user’s session.

The Persistable interface represents objects that are capable of serializing their states in string representation and restoring it back. An application may request a persistable object to save different levels of state defined in the EnumWebPersistableState interface:

  • The minimal state saves enough information to read the object again from the backend. Changes made to the object on the previous page may be lost.  

  • The typical state also stores changes to the object. The complete object state can be restored by first reading the object from the backend then restoring the saved state.  

  • The maximum state stores the entire object state so it can be restored without accessing the backend.

It is up to the application to determine how to persist a serialized object string (in cookies, JSP session object, etc.)

It has the following methods:

  • saveState()— Yields a string that an application can easily pass between components and pages.  

  • restoreString()— Restores the object’s state.

Any object that implements this interface allows saveState() and restoreState() to be used to easily serialize the object’s current state into a string and re-convert it to a live object.