org.marketcetera.util.spring
Class LazyBean

java.lang.Object
  extended by org.marketcetera.util.spring.LazyBean
Direct Known Subclasses:
SpringSessionDescriptor, SpringSessionSettings

public abstract class LazyBean
extends Object

A base class for a Spring bean which allows for on-demand post-processing. That is, one of more getters (of computed properties) may be guarded using ensureProcessed(), which will trigger processing of the bean's properties via process(). After processing, no setter guarded with assertNotProcessed() (of raw properties) may be called, or else the bean may find itself in an inconsistent state whereby the computed properties do not match the raw ones. The receiver detects and blocks circular processing attempts, whereby two separate but mutually dependent beans attempt to process each other during their own processing, thereby leading to an endless cycle.

Since:
1.0.0
Version:
$Id: LazyBean.java 16154 2012-07-14 16:34:05Z colin $
Author:
tlerios@marketcetera.com

Constructor Summary
LazyBean()
           
 
Method Summary
protected  void assertNotProcessed()
          Asserts that the receiver is not processed.
protected  void ensureProcessed()
          Ensures that the receiver is already processed, possibly by invoking process().
protected abstract  void process()
          Processes the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyBean

public LazyBean()
Method Detail

assertNotProcessed

protected void assertNotProcessed()
                           throws I18NRuntimeException
Asserts that the receiver is not processed.

Throws:
I18NRuntimeException - Thrown if it is.

ensureProcessed

protected void ensureProcessed()
Ensures that the receiver is already processed, possibly by invoking process().

Throws:
I18NRuntimeException - Thrown if a nested invocation occurs.

process

protected abstract void process()
Processes the receiver. This method will only be called once through ensureProcessed().



Copyright © 2012. All Rights Reserved.