toolbox.services
Class AbstractInterceptor

Package class diagram package AbstractInterceptor
java.lang.Object
  extended by toolbox.services.AbstractInterceptor
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, Interceptor
Direct Known Subclasses:
JAMonInterceptor, LoggingInterceptor

public abstract class AbstractInterceptor
extends java.lang.Object
implements Interceptor

Abstract implementation of the Interceptor interface. Provides some default implementations and convenience methods for implementing interceptor.


Constructor Summary
protected AbstractInterceptor()
          Protected constructor.
 
Method Summary
protected  java.lang.Object getObject()
          Convenience method to return the actual Object instance.
protected  java.lang.Object getTarget()
          Convenience method to return the invocation target Object instance.
protected  java.lang.Object invokeMethod(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Helper method to perform the method invocation.
 void setObject(java.lang.Object obj)
          Set the Object instance that is the actual Object instance.
 void setTarget(java.lang.Object target)
          Set the invocation target object instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface toolbox.services.Interceptor
init
 
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
 

Constructor Detail

AbstractInterceptor

protected AbstractInterceptor()
Protected constructor.

Method Detail

setTarget

public void setTarget(java.lang.Object target)
Set the invocation target object instance.

Specified by:
setTarget in interface Interceptor
Parameters:
target - Object instance that is the invocation target.

setObject

public void setObject(java.lang.Object obj)
Set the Object instance that is the actual Object instance.

Specified by:
setObject in interface Interceptor
Parameters:
obj - Object instance that is the actual object instance.

getTarget

protected java.lang.Object getTarget()
Convenience method to return the invocation target Object instance.

Returns:
Object instance that is the invocation target.

getObject

protected java.lang.Object getObject()
Convenience method to return the actual Object instance.

Returns:
Object instance that is the actual object instance.

invokeMethod

protected java.lang.Object invokeMethod(java.lang.Object proxy,
                                        java.lang.reflect.Method method,
                                        java.lang.Object[] args)
                                 throws java.lang.Throwable
Helper method to perform the method invocation.

Parameters:
proxy - Proxy instance method was invoked on.
method - Method instance, of an interface method, that was invoked on the proxy.
args - Method arguments.
Returns:
Object instance containing the result of the invocation.
Throws:
java.lang.Throwable - that occured during the method invocation.