Tie

Java Method Interception

Cook Book

Applying interception ot the return value

Problem:

A method that your are intercepting creates new objects, and you need to apply interception to these objects also.

Solution:

Use a combination of ReturnTypeRule and WrapReturnValueInterceptor inside your interception stack.

The jdbc_wrapper sample code demonstrates this pattern.