Table 7-4. Interceptor.Priority Values
Start of the range for interceptors that are defined by applications. (Value: 2000)
Start of the range for late interceptors that are defined by extension libraries. (Value: 3000)
Start of the range for early interceptors that are defined by extension libraries.
Start of the range for late interceptors that are defined by specifications of platforms.
Start of the range for early interceptors that are defined by specifications of platforms.
■ since the Interceptor.Priority value is a constant int , another int can be added to it in order to ensure
that a higher priority than other interceptors that are given the specified priority value. In the preceding example, the
value 10 is added to Interceptor.Priority.APPLICATION . the resulting priority then has the value 2010. (2000 is from
the APPLICATION priority. see table 7-4 ).
For more information on utilization of interceptors, please refer to the documentation that can be found online.
Decorators are Java classes that have the ability to intercept invocations for a particular Java interface, and therefore
they are aware of any semantics that apply to the specified interface. Additional functionality can then be applied
to the methods of the implementation class, and that additional functionality will be invoked and processed along
with the standard implementation. Decorators entail operations that include business logic, so they differ from
interceptors in that respect. In effect, the decorator class implementation surrounds the inner class. A decorator can
be an abstract class, and it must contain a special injection point known as the delegate injection point. This point
must be the same type as the beans being decorated, and it must be injected along with the @Delegate annotation.
Let's look at an example.
In this example, a human resources department may choose to implement a specialized hiring process for
employees in different departments. Rather than creating separate implementation classes, it would be easier to
“wrap” additional functionality around the standard implementation. In this case, a decorator class is used to add
functionality to the employee hiring process. The following class, EmployeeProcessorDecorator , demonstrates a
decorator that has the ability to implement additional functionality around the standard implementations for the Hire