public abstract @interface

Persistor

implements Annotation
sofia.app.Persistor

Class Overview

Provides custom persistence support for objects of the annotated class.

By default, most classes are persisted by storing all of their fields to the device's memory, and then reloaded by creating an instance using a parameterless constructor and then setting all of its fields using the saved data. If the class does not have a parameterless constructor, however, this process will fail.

If a class package.MyClass has a class in the same package named package.MyClassPersistor, then that class will be used to persist objects of that class. If the default package/naming convention is inappropriate for some reason, then this annotation can be used to provide the name of the persistor to use.

The persistor class must define two methods:

public static void represent(Object obj, Map<String, Object> rep)
Called when writing the object obj out to persistent storage. This method should store any data in rep that would be needed to reconstruct the object the next time the application runs.
public static Object construct(Map<String, Object> rep)
Called when a persisted object is being reconstructed from stored data. This method should use the values that were stored in the map rep to recreate the object and return it.

Summary

[Expand]
Inherited Methods
From interface java.lang.annotation.Annotation