001package co.codewizards.cloudstore.local.persistence; 002 003import java.util.Date; 004 005/** 006 * Automatically track changes by updating the {@link #getChanged() changed} property whenever 007 * the object is written to the datastore. 008 * <p> 009 * This interface is implemented by persistence-capable (a.k.a. entity) classes. If an object 010 * implementing this interface is written to the datastore (inserted or updated), the 011 * {@link co.codewizards.cloudstore.local.AutoTrackLifecycleListener AutoTrackLifecycleListener} 012 * automatically invokes the {@link #setChanged(Date)} method. 013 * @author Marco หงุ่ยตระกูล-Schulze - marco at codewizards dot co 014 * @see co.codewizards.cloudstore.local.AutoTrackLifecycleListener 015 */ 016public interface AutoTrackChanged { 017 /** 018 * Gets the timestamp of when this entity was last changed. 019 * @return the timestamp of when this entity was last changed. Never <code>null</code>. 020 */ 021 Date getChanged(); 022 /** 023 * Sets the timestamp of when this entity was last changed. 024 * @param changed the timestamp of when this entity was last changed. Must not be <code>null</code>. 025 */ 026 void setChanged(Date changed); 027}