Browse Source

renamed ValueWrapperImpl to SimpleValueWrapper (for use in Cache implementations)

pull/7/head
Juergen Hoeller 13 years ago
parent
commit
bba70a7f12
  1. 4
      org.springframework.context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java
  2. 4
      org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheCache.java
  3. 16
      org.springframework.context/src/main/java/org/springframework/cache/support/SimpleValueWrapper.java

4
org.springframework.context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java vendored

@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap; @@ -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 { @@ -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) {

4
org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheCache.java vendored

@ -21,7 +21,7 @@ import net.sf.ehcache.Element; @@ -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 { @@ -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) {

16
org.springframework.context/src/main/java/org/springframework/cache/support/ValueWrapperImpl.java → org.springframework.context/src/main/java/org/springframework/cache/support/SimpleValueWrapper.java vendored

@ -19,19 +19,29 @@ package org.springframework.cache.support; @@ -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 <code>null</code>)
*/
public SimpleValueWrapper(Object value) {
this.value = value;
}
/**
* Simply returns the value as given at construction time.
*/
public Object get() {
return this.value;
}
Loading…
Cancel
Save