Class NamedEventInterceptorBuilder

  • All Implemented Interfaces:
    BuilderCustomization<EventInterceptor>, ParameterizedBuilder<NamedEventInterceptor>

    public class NamedEventInterceptorBuilder
    extends Object
    implements ParameterizedBuilder<NamedEventInterceptor>, BuilderCustomization<EventInterceptor>
    An NamedEventInterceptorBuilder facilitates the construction of a NamedEventInterceptor, which wraps an EventInterceptor. The wrapped EventInterceptor will be constructed based on its instance / class-scheme XML declaration, honoring any init-params defined.

    The construction of a NamedEventInterceptor allows metadata associated with the EventInterceptor to be held. This metadata is used to determine eligibility against EventDispatchers and for registration purposes.

    In addition to XML being used as input in defining an EventInterceptor and its metadata the presence of an annotation (Interceptor) can also contribute. This annotation can define the identifier for this interceptor, the event types to subscribe to and whether to be placed first in the chain of EventInterceptors (Interceptor.Order.HIGH.

    NamedEventInterceptor objects also use class level generic type definitions as input for configuration. The generic type definition allows EventInterceptor implementations to restrict on event types by narrowing the type definition within the reference to the EventInterceptor interface. For example, the following interceptor restricts to only accept transfer events:

    
         class MyInterceptor
                 implements EventInterceptor<TransferEvent>
             {
             public void onEvent(TransferEvent event);
             }
     
    The precedence, in highest order first reading left to right, for configuration is as follows:
    
         XML -> Annotation -> Generic Type Bounds
     
    Since:
    Coherence 12.1.2
    Author:
    hr 2011.10.05