ERXLazyValue< T > Class Reference

Collaboration diagram for ERXLazyValue< T >:

Collaboration graph
[legend]

List of all members.

Classes

class  AjaxPageUserInfoCacheKeyInvalidator
class  AlwaysInvalidator
class  CacheKeyInvalidator
class  ConstantSource< T >
interface  Invalidator
class  KVCSource< T >
class  MutableCacheKeyInvalidator
class  NeverInvalidator
class  PageUserInfoCacheKeyInvalidator
interface  Source< T >
class  ThreadStorageCacheKeyInvalidator
class  TimedInvalidator

Public Member Functions

 ERXLazyValue (ERXLazyValue.Source< T > dataSource, ERXLazyValue.Invalidator invalidator)
 ERXLazyValue (Object target, String keyPath, ERXLazyValue.Invalidator invalidator)
 ERXLazyValue (Object target, String keyPath)
 ERXLazyValue (ERXLazyValue.Source< T > dataSource)
synchronized void invalidate ()
synchronized void setValue (T value)
synchronized T value ()

Static Public Attributes

static Logger log = Logger.getLogger(ERXLazyValue.class)

Private Attributes

ERXLazyValue.Source< T > _dataSource
ERXLazyValue.Invalidator _invalidator
_value
boolean _valueCached


Detailed Description

ERXLazyValue provides a way to model lazy-loaded values that invalidate with different methods. This is very useful for storing expensive values that are returned from bound component methods as well as values that are cached that are influenced by different areas of a single page (i.e. ajax operations on one part of the page that need to invalidate a cache on another part of the page).

Author:
mschrag
Parameters:
<T> the type of the lazy value

Constructor & Destructor Documentation

ERXLazyValue ( ERXLazyValue< T >.Source< T >  dataSource  ) 

Constructs a new ERXLazyValue with a data source and a NeverInvalidator, which behaves like a "once" lazy value.

Parameters:
dataSource the data source for the lazy value

ERXLazyValue ( Object  target,
String  keyPath 
)

Constructs a new ERXLazyValue with a shortcut for a KVCSource and a NeverInvalidator, which behaves like a "once" lazy value.

Parameters:
target the target of the KVCSource
keyPath the keypath of the KVCSource

ERXLazyValue ( Object  target,
String  keyPath,
ERXLazyValue< T >.Invalidator  invalidator 
)

Constructs a new ERXLazyValue with a shortcut for a KVCSource and an invalidator.

Parameters:
target the target of the KVCSource
keyPath the keypath of the KVCSource
invalidator the invalidator to use

ERXLazyValue ( ERXLazyValue< T >.Source< T >  dataSource,
ERXLazyValue< T >.Invalidator  invalidator 
)

Constructs a new ERXLazyValue with a data source and an invalidator.

Parameters:
dataSource the data source for the lazy value
invalidator the invalidator to use


Member Function Documentation

synchronized void invalidate (  ) 

Forecfully invalidates the lazy value, regardless of the state of the invalidator.

synchronized void setValue ( value  ) 

Sets the backging value for this lazy value, which will always call through to the underlying data source. This will also cache the new value and notify the invalidator of a new fetched value (acting just like if value() was called on an invalidated cache).

Parameters:
value the new value

synchronized T value (  ) 

Returns the backing value for this lazy value, which will only sometimes trigger a call through to the data source.

Returns:
the backing value


Member Data Documentation

ERXLazyValue.Source<T> _dataSource [private]

ERXLazyValue.Invalidator _invalidator [private]

T _value [private]

boolean _valueCached [private]

Logger log = Logger.getLogger(ERXLazyValue.class) [static]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:13 2012 for Project Wonder by  doxygen 1.5.8