org.skife.intercept
Class InterceptionBroker

java.lang.Object
  |
  +--org.skife.intercept.InterceptionBroker

public class InterceptionBroker
extends java.lang.Object

provide interception matches against arbitrary non-final objects


Constructor Summary
InterceptionBroker()
          Create a new, unbaked InterceptionBroker
 
Method Summary
 void addInterceptor(java.lang.Class interceptor, org.skife.intercept.Signature signature)
          Used to add an interceptor where a new Interceptor will be instantiated for each invocation.
 void addInterceptor(org.skife.intercept.InterceptorFactory factory, org.skife.intercept.Signature signature)
          Used to add an interceptor where a new Interceptor will be instantiated for each invocation.
 void addInterceptor(org.skife.intercept.Interceptor interceptor, org.skife.intercept.Signature signature)
          The Interceptor passed here will be used for every method invocation.
 void bake()
          Bake this broker.
 org.skife.intercept.InterceptedObject wrap(java.lang.Object obj)
          Wrap an arbitrary object in whatever interceptors match it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterceptionBroker

public InterceptionBroker()
Create a new, unbaked InterceptionBroker

Method Detail

wrap

public org.skife.intercept.InterceptedObject wrap(java.lang.Object obj)
Wrap an arbitrary object in whatever interceptors match it.

It is important to note that an object can only be wrapped by a single broker at a time, or to put it more specifically, a broker will NOT wrap an already wrapped object -- this is a meaningless triviality when attempting to wrap the same object via the same broker multiple times, but it means that if an InterceptedObject is passed to this method, you will get the same object back with no changes.

Parameters:
obj - must not be declared final
Returns:
a subclass wrapping obj which will be intercepted

bake

public void bake()
Bake this broker. Baking removes the ability to add new interceptors but significantly increases the performance of objects wrapped after baking has occured.


addInterceptor

public void addInterceptor(java.lang.Class interceptor,
                           org.skife.intercept.Signature signature)
Used to add an interceptor where a new Interceptor will be instantiated for each invocation.

Parameters:
interceptor - Class implementing Interceptor
signature - Signature which will be matched for interception
Throws:
java.lang.UnsupportedOperationException - if the broker has been baked

addInterceptor

public void addInterceptor(org.skife.intercept.InterceptorFactory factory,
                           org.skife.intercept.Signature signature)
Used to add an interceptor where a new Interceptor will be instantiated for each invocation.

Parameters:
factory - used to build a new Interceptor on each invocation
signature - Signature which will be matched for interception
Throws:
java.lang.UnsupportedOperationException - if the broker has been baked

addInterceptor

public void addInterceptor(org.skife.intercept.Interceptor interceptor,
                           org.skife.intercept.Signature signature)
The Interceptor passed here will be used for every method invocation. Make sure it is threadsafe if you are in a multithreaded environment!

Parameters:
interceptor - Singleton interceptor
signature -
Throws:
java.lang.UnsupportedOperationException - if the broker has been baked