From bba70a7f1283215872b17aa31adb0a7cce16d3e6 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 28 Nov 2011 15:52:42 +0000 Subject: [PATCH] renamed ValueWrapperImpl to SimpleValueWrapper (for use in Cache implementations) --- .../cache/concurrent/ConcurrentMapCache.java | 4 ++-- .../cache/ehcache/EhCacheCache.java | 4 ++-- ...eWrapperImpl.java => SimpleValueWrapper.java} | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) rename org.springframework.context/src/main/java/org/springframework/cache/support/{ValueWrapperImpl.java => SimpleValueWrapper.java} (68%) diff --git a/org.springframework.context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java b/org.springframework.context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java index 0fa632d2a0..71e8561bec 100644 --- a/org.springframework.context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java +++ b/org.springframework.context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.springframework.cache.Cache; -import org.springframework.cache.support.ValueWrapperImpl; +import org.springframework.cache.support.SimpleValueWrapper; /** * Simple {@link Cache} implementation based on the core JDK @@ -96,7 +96,7 @@ public class ConcurrentMapCache implements Cache { public ValueWrapper get(Object key) { Object value = this.store.get(key); - return (value != null ? new ValueWrapperImpl(fromStoreValue(value)) : null); + return (value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null); } public void put(Object key, Object value) { diff --git a/org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheCache.java b/org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheCache.java index b513e56ff4..9258d76895 100644 --- a/org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheCache.java +++ b/org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheCache.java @@ -21,7 +21,7 @@ import net.sf.ehcache.Element; import net.sf.ehcache.Status; import org.springframework.cache.Cache; -import org.springframework.cache.support.ValueWrapperImpl; +import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.util.Assert; /** @@ -63,7 +63,7 @@ public class EhCacheCache implements Cache { public ValueWrapper get(Object key) { Element element = this.cache.get(key); - return (element != null ? new ValueWrapperImpl(element.getObjectValue()) : null); + return (element != null ? new SimpleValueWrapper(element.getObjectValue()) : null); } public void put(Object key, Object value) { diff --git a/org.springframework.context/src/main/java/org/springframework/cache/support/ValueWrapperImpl.java b/org.springframework.context/src/main/java/org/springframework/cache/support/SimpleValueWrapper.java similarity index 68% rename from org.springframework.context/src/main/java/org/springframework/cache/support/ValueWrapperImpl.java rename to org.springframework.context/src/main/java/org/springframework/cache/support/SimpleValueWrapper.java index cc8ab88f5e..8f2fb39166 100644 --- a/org.springframework.context/src/main/java/org/springframework/cache/support/ValueWrapperImpl.java +++ b/org.springframework.context/src/main/java/org/springframework/cache/support/SimpleValueWrapper.java @@ -19,19 +19,29 @@ package org.springframework.cache.support; import org.springframework.cache.Cache.ValueWrapper; /** - * Straightforward implementation of {@link org.springframework.cache.Cache.ValueWrapper}. + * Straightforward implementation of {@link org.springframework.cache.Cache.ValueWrapper}, + * simply holding the value as given at construction and returning it from {@link #get()}. * * @author Costin Leau * @since 3.1 */ -public class ValueWrapperImpl implements ValueWrapper { +public class SimpleValueWrapper implements ValueWrapper { private final Object value; - public ValueWrapperImpl(Object value) { + + /** + * Create a new SimpleValueWrapper instance for exposing the given value. + * @param value the value to expose (may be null) + */ + public SimpleValueWrapper(Object value) { this.value = value; } + + /** + * Simply returns the value as given at construction time. + */ public Object get() { return this.value; }