Save This Page
Home » xwork-2.1.5 » com.opensymphony » xwork2 » inject » util » [javadoc | source]
com.opensymphony.xwork2.inject.util
abstract public class: ReferenceCache [javadoc | source]
java.lang.Object
   com.opensymphony.xwork2.inject.util.ReferenceMap<K, V>
      com.opensymphony.xwork2.inject.util.ReferenceCache

All Implemented Interfaces:
    Map, Serializable

Extends ReferenceMap to support lazy loading values by overriding #create(Object) .
Nested Class Summary:
class  ReferenceCache.CallableCreate   
Field Summary
transient  ConcurrentMap<V> futures     
transient  ThreadLocal<V> localFuture     
Fields inherited from com.opensymphony.xwork2.inject.util.ReferenceMap:
delegate,  keyReferenceType,  valueReferenceType
Constructor:
 public ReferenceCache() 
 public ReferenceCache(ReferenceType keyReferenceType,
    ReferenceType valueReferenceType) 
Method from com.opensymphony.xwork2.inject.util.ReferenceCache Summary:
cancel,   create,   get,   internalCreate,   of
Methods from com.opensymphony.xwork2.inject.util.ReferenceMap:
clear,   containsKey,   containsValue,   dereference,   dereferenceCollection,   dereferenceEntry,   dereferenceKey,   dereferenceKeySet,   dereferenceValue,   dereferenceValues,   ensureNotNull,   ensureNotNull,   entrySet,   execute,   get,   getPutStrategy,   internalGet,   isEmpty,   keyHashCode,   keySet,   makeKeyReferenceAware,   makeValueReferenceAware,   put,   putAll,   putIfAbsent,   putIfAbsentStrategy,   putStrategy,   referenceEquals,   referenceKey,   referenceValue,   remove,   remove,   replace,   replace,   replaceStrategy,   size,   values
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.xwork2.inject.util.ReferenceCache Detail:
 protected  void cancel() 
 abstract protected V create(K key)
    Override to lazy load values. Use as an alternative to #put(Object,Object) . Invoked by getter if value isn't already cached. Must not return {@code null}. This method will not be called again until the garbage collector reclaims the returned value.
 public V get(Object key) 
    {@inheritDoc} If this map does not contain an entry for the given key and #create(Object) has been overridden, this method will create a new value, put it in the map, and return it.
 V internalCreate(K key) 
 public static ReferenceCache<K, V> of(ReferenceType keyReferenceType,
    ReferenceType valueReferenceType,
    Function<? super K, ? extends V> function) 
    Returns a {@code ReferenceCache} delegating to the specified {@code function}. The specified function must not return {@code null}.