Development Guide

Storable

Storable is an interface, which allows Extensions and Modules (ProxyModule, InterceptorModule) to store arbitrary data in the project configuration.

Data are stored as JSON structure, however, for simplicity, serialization process is automatic.

Storable interface

com.warxim.petep.persistence.Storable
/**
 * Allows extensions and modules to define their own data stores that are serialized to JSON
 * structure and saved to project files.
 * <p>Allows extensions/modules to load/save store of any serializable type.</p>
 * <p>Loading of all stores occurs during start of PETEP.</p>
 * @param <S> Type of the storable object
 */
@PetepAPI
public interface Storable<S> {
    /**
     * Obtains store to be saved.
     * @return Serializable store, which will be stored by PETEP
     */
    S saveStore();

    /**
     * Loads store.
     * @param store Deserialized store
     */
    void loadStore(S store);
}