Home
Overview
Architecture
Language
Weave
Implementation
Licence

Persist Descriptor Language

The Persistence Descriptor Language (PerDL) is based on the aspect description language (ADL). However, instead of placing aspect information into a single file, the new language incorporates it's data into the source of the persistent classes themselves.

PerDL is 'compatible' with the aspect description language in the sense that transformation from the latter to the former is a trivial matter. Eventually, an implementation of ADL, dealing with all of the aspects described in it could use Persist/J for the persistency of ADL. The ADL weaver could transform ADL's persistency-related parts to PerDL.

Note that the class needs a default constructor for Persist to work.

The persistency is described as a special comment block at the end of the class source file, not entirely unlike JavaDoc comments. The start of the PerDL information is a /*_PerDL_, and ends with a regular */.

The syntax of the PerDL block is described bellow:

/*_PerDL_
        attributes=attr1 [attr2 [...]] ;
        before_save=method ;
        after_load=method ;
*/

White space between words are accepted. Order is not important.

Description of the fields:

attribute A list of persistent attributes. These are saved to the database at the time when the objects are saved. Don't list attributes here that are calculated from other persistent attributes, use after_load to set those. Also don't list transient variables, which are only meaningful for the current session. Set those in the class constructor, or after_load.

before_save (optional) Name of the method to be called before the object is saved to the database. Use this only if there is need for special cleanup.

after_load (optional) Name of the method to be called after the object is loaded from the database. See attribute above for examples on use.