All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nasdanika.persistence.Persistent Maven / Gradle / Ivy

There is a newer version: 2024.9.0
Show newest version
package org.nasdanika.persistence;

/**
 * Something which knows how to store state into storage and load it from it.
 * @author Pavel Vlasov
 * 
 * @param  Referenced object type.
 * @param  Reference type.
 * @param  Storage type.
 */
public interface Persistent {
	
	/**
	 * Loads state from the storage.
	 * @param storage Storage.
	 * @param resolver Reference resolver. Can be ``null`` if the object itself "knows" how to resolve references,
	 * e.g. it utilizes object proxies resolved on access.
	 */
	void load(S storage, Resolver resolver);
	
	/**
	 * Same as load(storage, null).
	 * @param storage
	 */
	default void load(S storage) {
		load(storage, null);
	}
	
	/**
	 * Stores state into the storage.
	 * @param storage
	 */
	void store(S storage, Referencer referencer);
	
	/**
	 * Same as store(storage, null).
	 * @param storage
	 */
	default void store(S storage) {
		store(storage, null);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy