org.simpleframework.xml.core
Annotation Type Persist


@Retention(value=RUNTIME)
public @interface Persist

The Persist annotation is used to mark a method that requires a callback from the persister before serialization of an object begins. If a method is marked with this annotation then it will be invoked so that it can prepare the object for the serialization process.

The persist method can be used to perform any preparation needed before serialization. For example, should the object be a list or table of sorts the persist method can be used to grab a lock for the internal data structure. Such a scheme will ensure that the object is serialized in a known state. The persist method must be a no argument public method or a method that takes a single Map argument, it may throw an exception to terminate the serialization process if required.

Author:
Niall Gallagher
See Also:
Complete