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

net.anotheria.anoprise.cache.CachedObjectWrapper Maven / Gradle / Ivy

Go to download

Collection of utils for different enterprise class projects. Among other stuff contains Caches, Mocking, DualCrud, MetaFactory and SessionDistributorService. Visit https://opensource.anotheria.net for details.

There is a newer version: 4.0.0
Show newest version
package net.anotheria.anoprise.cache;

/**
 * Wrapper object. This object is used for expiration caches to add the timestamp of the object creation.
 * @author lrosenberg
 * @param  a cacheable that we wrap.
 */
public class CachedObjectWrapper {
	/**
	 * The wrapped object.
	 */
	private T obj;
	/**
	 * Timestamp of wrapper creation.
	 */
	private long timestamp;
	
	public CachedObjectWrapper(T anObject){
		obj = anObject;
		timestamp = System.currentTimeMillis();
	}

	/**
	 * Returns the underlying object.
	 * @return
	 */
	public T getObj() {
		return obj;
	}

	public void setObj(T anObj) {
		obj = anObj;
	}

	public long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy