ehcache

net.sf.ehcache.store.compound
Interface ElementSubstituteFactory<T extends ElementSubstitute>

Type Parameters:
T - type of the created and retrievable element substitutes.
All Known Implementing Classes:
DiskOverflowStorageFactory, DiskPersistentStorageFactory

public interface ElementSubstituteFactory<T extends ElementSubstitute>

ElementSubstituteFactory is implemented by all true substituting factories.

A true substituting factory returns an ElementSubstitute instance instead of an Element on calls to encode. ElementSubstitute instances may simply be wrapping Elements with additional functionality (e.g. a soft/weak reference) or be indirectly referencing an Element (e.g. a pointer to a secondary storage location).

Author:
Chris Dennis

Method Summary
 void bind(CompoundStore store)
          Bind a store instance to this factory.
 T create(Object key, Element element)
          Creates a substitute for the supplied Element
 boolean created(Object object)
          Returns true if this factory created the given object.
 void free(Lock exclusion, T object)
          Free any manually managed resources used by this ElementSubstitute.
 Element retrieve(Object key, T object)
          Decodes the supplied ElementSubstitute.
 void unbind(CompoundStore store)
          Unbinds a store instance from this factory
 

Method Detail

create

T create(Object key,
         Element element)
                                   throws IllegalArgumentException
Creates a substitute for the supplied Element

In the case that this element is no longer mapped to a key - if for example the element is being decoded following a removal - then the supplied key will be null.

Parameters:
key - key to which this element is mapped
element - Element to encode
Returns:
The substitute element
Throws:
IllegalArgumentException - if element cannot be substituted

retrieve

Element retrieve(Object key,
                 T object)
Decodes the supplied ElementSubstitute.

Parameters:
object - ElementSubstitute to decode
key - key to which this element is mapped
Returns:
a decoded Element

free

void free(Lock exclusion,
          T object)
Free any manually managed resources used by this ElementSubstitute.

Parameters:
object - ElementSubstitute being free'd.

bind

void bind(CompoundStore store)
Bind a store instance to this factory.

Parameters:
store - store to bind

unbind

void unbind(CompoundStore store)
Unbinds a store instance from this factory

Parameters:
store - store to unbind

created

boolean created(Object object)
Returns true if this factory created the given object.

Parameters:
object - object to check
Returns:
true if object created by this factory

ehcache

true