Tie

Java Method Interception

Cook Book

Creating a new interceptor for each object

Problem:

Your interceptor stores state, and you need each object that is being wrapped to have a new instance of the interceptor.

Solution:

Implement InterceptorFactory and create a new object for each call to getInterceptor.

Use DynamicInterceptorStack.addFactory to insert your factory into a interceptor stack.