net.sf.tie.ext
Class DynamicInterceptorStack

java.lang.Object
  extended by net.sf.tie.ext.DynamicInterceptorStack
All Implemented Interfaces:
MethodInterceptorStack

public class DynamicInterceptorStack
extends Object
implements MethodInterceptorStack

A DynamicInterceptorStack uses a list of InterceptorFactory to build the interceptor stack for each required endPoint.


Constructor Summary
DynamicInterceptorStack()
           
 
Method Summary
 void addFactory(InterceptorFactory factory)
          Add a factory to the collection of factory to be consulted during a call to getInterceptors(Class, Object).
<T> Iterable<MethodInterceptor>
getInterceptors(Class<T> type, T endPoint)
          Consults the collection of InterceptorFactory instances to build an interception stack.
The factories will be consulted in the order in which they are added - the first factory added will be the first one consulted, and any interceptor it creates will be at the top of the stack.
A factory may return null if it does not have an interceptor to provide.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicInterceptorStack

public DynamicInterceptorStack()
Method Detail

addFactory

public void addFactory(InterceptorFactory factory)
Add a factory to the collection of factory to be consulted during a call to getInterceptors(Class, Object). The factory collection follows the semantics of a List. A factory may be safely added twice if it is to be consulted twice during the execution of getInterceptors(Class, Object).


getInterceptors

public <T> Iterable<MethodInterceptor> getInterceptors(Class<T> type,
                                                       T endPoint)
Consults the collection of InterceptorFactory instances to build an interception stack.
The factories will be consulted in the order in which they are added - the first factory added will be the first one consulted, and any interceptor it creates will be at the top of the stack.
A factory may return null if it does not have an interceptor to provide.

Specified by:
getInterceptors in interface MethodInterceptorStack
Parameters:
type - The java type (typically an interface) which declares the methods to be intercepted.
endPoint - The java object that provides an implementation of those methods.
Returns:
A set of interceptors to apply over all invocations of methods on endPoint.