org.qi4j.api.sideeffect
Class GenericSideEffect

java.lang.Object
  extended by org.qi4j.api.sideeffect.SideEffectOf<InvocationHandler>
      extended by org.qi4j.api.sideeffect.GenericSideEffect
All Implemented Interfaces:
InvocationHandler
Direct Known Subclasses:
CacheInvocationResultSideEffect, InvalidateCacheOnSettersSideEffect

public abstract class GenericSideEffect
extends SideEffectOf<InvocationHandler>
implements InvocationHandler

Base class for generic SideEffects.


Field Summary
 
Fields inherited from class org.qi4j.api.sideeffect.SideEffectOf
result
 
Constructor Summary
GenericSideEffect()
           
 
Method Summary
protected  void invoke(Method method, Object[] args)
          Convenience method to be overridden by subclasses in order to avoid returning null, as returned value from side effects is not taken in consideration.
 Object invoke(Object proxy, Method method, Object[] args)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericSideEffect

public GenericSideEffect()
Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

invoke

protected void invoke(Method method,
                      Object[] args)
               throws Throwable
Convenience method to be overridden by subclasses in order to avoid returning null, as returned value from side effects is not taken in consideration.

Parameters:
method - the method that was invoked
args - the arguments of the method invocation
Throws:
Throwable - - the exception to throw from the method invocation on the proxy instance. The exception's type must be assignable either to any of the exception types declared in the throws clause of the interface method or to the unchecked exception types {code}java.lang.RuntimeException{code} or {code}java.lang.Error{code}. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in the throws clause of the interface method, then an UndeclaredThrowableException containing the exception that was thrown by this method will be thrown by the method invocation on the proxy instance.