X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fcache%2FCachedObject.java;h=f8eb8b0fad49c6c900f351ba6c6325c7168f503c;hb=8de36ff0206c996baf3ee4adc3e2293b12ff5f39;hp=bdabd51795a92787893ed87c862827a8eb754586;hpb=89c06d4d52b46c154128c97d6e758fa1f4fc7a6e;p=utils diff --git a/support/general/src/main/java/org/wamblee/cache/CachedObject.java b/support/general/src/main/java/org/wamblee/cache/CachedObject.java index bdabd517..f8eb8b0f 100644 --- a/support/general/src/main/java/org/wamblee/cache/CachedObject.java +++ b/support/general/src/main/java/org/wamblee/cache/CachedObject.java @@ -19,21 +19,15 @@ import org.apache.log4j.Logger; import java.io.Serializable; - /** - * Represents a cached object. The object is either retrieved from the - * cache if the cache has it, or a call back is invoked to get the object (and - * put it in the cache). - * + * Represents a cached object. The object is either retrieved from the cache if + * the cache has it, or a call back is invoked to get the object (and put it in + * the cache). + * * @author Erik Brakkee - * - * @param DOCUMENT ME! - * @param DOCUMENT ME! + * */ public class CachedObject { - /** - * DOCUMENT ME! - */ private static final Logger LOGGER = Logger.getLogger(CachedObject.class); /** @@ -47,14 +41,13 @@ public class CachedObject computation; -/** + /** * Constructs the cached object. - * + * * @param aCache * Cache to use. * @param aObjectKey @@ -65,21 +58,21 @@ public class CachedObject aCache, KeyType aObjectKey, Computation aComputation) { - cache = aCache; - objectKey = aObjectKey; - computation = aComputation; + cache = aCache; + objectKey = aObjectKey; + computation = aComputation; } /** - * Gets the object. Since the object is cached, different calls to - * this method may return different objects. - * + * Gets the object. Since the object is cached, different calls to this + * method may return different objects. + * * @return Object. */ public ValueType get() { ValueType object = (ValueType) cache.get(objectKey); // the used - // cache is - // thread safe. + // cache is + // thread safe. if (object == null) { // synchronize the computation to make sure that the object is only @@ -104,8 +97,8 @@ public class CachedObject * Type of the object */ public static interface Computation { /** - * Gets the object. Called when the object is not in the - * cache. - * - * @param aObjectKey Id of the object in the cache. - * + * Gets the object. Called when the object is not in the cache. + * + * @param aObjectKey + * Id of the object in the cache. + * * @return Object, must be non-null. */ Value getObject(Key aObjectKey);