Annotation Type PostLoad


  • @Documented
    @Inherited
    @Retention(RUNTIME)
    @Target(METHOD)
    public @interface PostLoad
    Called after the data has been loaded into the java object. This is a good place to perform initialization and sanity-checking of the object.

    Methods with this annotation may optionally take a parameter of type Document and/or a parameter of type Datastore. If both parameters are used, the order is unimportant.

    The Document parameter (if used) will be the document that this object was loaded from. The Datastore parameter (if used) will be the datastore this object was loaded from.

    Example declarations (in order of most to least typical):

     @PostLoad
     void cleanUpAfterLoading() {
       // perform initialization here as needed.
     }
     
     @PostLoad
     void examineAdditionalDocumentElements(Document doc) {
       // doc is the Document we were loaded from. Document elements can be examined manually here. 
       // Note that changes to doc will not have any effect (as it's already been read from).
     }
     
     @PostLoad
     void performComplexAdditionalQueriesAfterLoading(Document doc, Datastore datastore) {
       // doc is the Document we were loaded from. datastore is the datastore we were loaded from.
     }
     
    Author:
    Scott Hernandez
    See Also:
    PreLoad, PrePersist, PostPersist