jfun.yan.lifecycle
Class LiveObject

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by java.lang.ref.WeakReference
          extended by jfun.util.WeakRef
              extended by jfun.yan.lifecycle.LiveObject

public class LiveObject
extends WeakRef

This class encapsulates life-cycle information for a regular Java object.

Zephyr Business Solution

Author:
Michelle Lei

Constructor Summary
LiveObject(java.lang.Object obj, java.util.Map procs)
          To create a LiveObject for a regular java object.
 
Method Summary
 boolean containsPhase(java.lang.Object key)
          To determine if a certain phase exists in the life-cycle.
 Procedure getProc(java.lang.Object key)
          Get the Procedure for a certain phase.
 void invoke(java.lang.Object key, java.lang.Object[] args)
          To invoke the procedure for a certain phase.
 
Methods inherited from class jfun.util.WeakRef
equals, hashCode
 
Methods inherited from class java.lang.ref.Reference
clear, enqueue, get, isEnqueued
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiveObject

public LiveObject(java.lang.Object obj,
                  java.util.Map procs)
To create a LiveObject for a regular java object.

Parameters:
obj - the regular java object.
procs - the map from phase key to Procedure objects.
Method Detail

containsPhase

public boolean containsPhase(java.lang.Object key)
To determine if a certain phase exists in the life-cycle.

Parameters:
key - the key of the phase.
Returns:
true if existent.

getProc

public Procedure getProc(java.lang.Object key)
Get the Procedure for a certain phase.

Parameters:
key - the key of the phase.
Returns:
the Procedure object for the phase. null if not found.

invoke

public void invoke(java.lang.Object key,
                   java.lang.Object[] args)
            throws java.lang.Throwable
To invoke the procedure for a certain phase.

Parameters:
key - the key of the phase.
args - the arguments to the procedure.
Throws:
java.lang.Throwable - any exception thrown out of the procedure.