You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
Interceptors and decorators are applied for business method invocations. For a detailed overview of what a business method invocation is, it's best to consult the JSR-299 specification, more specifically section 7.2.
Remember that only references provided by the container are intercepted or decorated. This is important when considering self-invocations (calls to this) - these calls are not business method invocations and will not be intercepted and decorated.
To illustrate this concept, assuming that @InterceptMe is an interceptor binding:
class SelfInvokingClass {
@InterceptMe
public void methodA() {}
@InterceptMe
public void methodB() {
this.methodA()
}
}
class InvokerClass {
@Inject SelfInvokingClass dependency;
public void callMethodA() {
dependency.methodA();
}
public void callMethodB() {
dependency.methodB();
}
}
When calling InvokerClass.callMethodA(), methodA() will be intercepted.
When calling InvokerClass.callMethodB(), methodB() will be intercepted, but methodA() (invoked from within methodB()) won't be.