renamed ValueWrapperImpl to SimpleValueWrapper (for use in Cache implementations)
This commit is contained in:
parent
372d461bef
commit
bba70a7f12
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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…
Reference in New Issue