Only intercepting some objects
Problem:
You have a number of different objects in your application, and you want to intercept some (but not all) of them.
Solution 1
If this is a case that some objects need the full interception stack, and the rest don't need interception at all, then simply don't apply interception to the ones that don't need it.
Tie can be safely used in a subset of your application without impacting the rest of your application.
Solution 2
If you want to apply different sets of interceptors to different types of objects, then you can have multiple ProxyInjector instances each configured with a different MethodInterceptionStack.
When you go to apply interception to an object, look at its type and then select the appropriate injector to use.
Solution 3
Use the InterceptionBuilder to apply InterceptionRules to your stack.
Read the javadoc or the following recipes for more information on using rules.
Solution 4
Add logic into your interceptors to simply call MethodInvocation.proceed()
for objects that do not
match your criteria. e.g.
public Object invoke(MethodInvocation invocation) throws Throwable { if( shouldIntercept() ) { // ... } else { return invocation.proceed() ; } }