git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed DOCUMENT ME comments that were generated and applied source code
[utils]
/
support
/
general
/
src
/
main
/
java
/
org
/
wamblee
/
cache
/
CachedObject.java
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 bdabd51795a92787893ed87c862827a8eb754586..f8eb8b0fad49c6c900f351ba6c6325c7168f503c 100644
(file)
--- 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;
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
* @author Erik Brakkee
- *
- * @param <KeyType> DOCUMENT ME!
- * @param <ValueType> DOCUMENT ME!
+ *
*/
public class CachedObject<KeyType extends Serializable, ValueType extends Serializable> {
*/
public class CachedObject<KeyType extends Serializable, ValueType extends Serializable> {
- /**
- * DOCUMENT ME!
- */
private static final Logger LOGGER = Logger.getLogger(CachedObject.class);
/**
private static final Logger LOGGER = Logger.getLogger(CachedObject.class);
/**
@@
-47,14
+41,13
@@
public class CachedObject<KeyType extends Serializable, ValueType extends Serial
private KeyType objectKey;
/**
private KeyType objectKey;
/**
- * Computation used to obtain the object if it is not found in the
- * cache.
+ * Computation used to obtain the object if it is not found in the cache.
*/
private Computation<KeyType, ValueType> computation;
*/
private Computation<KeyType, ValueType> computation;
-/**
+
/**
* Constructs the cached object.
* Constructs the cached object.
- *
+ *
* @param aCache
* Cache to use.
* @param aObjectKey
* @param aCache
* Cache to use.
* @param aObjectKey
@@
-65,21
+58,21
@@
public class CachedObject<KeyType extends Serializable, ValueType extends Serial
*/
public CachedObject(Cache<KeyType, ValueType> aCache, KeyType aObjectKey,
Computation<KeyType, ValueType> aComputation) {
*/
public CachedObject(Cache<KeyType, ValueType> aCache, KeyType aObjectKey,
Computation<KeyType, ValueType> 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
* @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
if (object == null) {
// synchronize the computation to make sure that the object is only
@@
-104,8
+97,8
@@
public class CachedObject<KeyType extends Serializable, ValueType extends Serial
}
/**
}
/**
- * Invalidates the cache for the object so that it is recomputed
- * t
he next t
ime it is requested.
+ * Invalidates the cache for the object so that it is recomputed
the next
+ * time it is requested.
*/
public void invalidate() {
cache.remove(objectKey);
*/
public void invalidate() {
cache.remove(objectKey);
@@
-113,26
+106,26
@@
public class CachedObject<KeyType extends Serializable, ValueType extends Serial
/**
* Gets the cache.
/**
* Gets the cache.
- *
+ *
* @return Cache.
*/
public Cache getCache() {
return cache;
}
* @return Cache.
*/
public Cache getCache() {
return cache;
}
-/**
+
/**
* Callback invoked to compute an object if it was not found in the cache.
* Callback invoked to compute an object if it was not found in the cache.
- *
+ *
* @param <T>
* Type of the object
*/
public static interface Computation<Key extends Serializable, Value extends Serializable> {
/**
* @param <T>
* Type of the object
*/
public static interface Computation<Key extends Serializable, Value extends Serializable> {
/**
- * 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);
* @return Object, must be non-null.
*/
Value getObject(Key aObjectKey);