javax.enterprise.inject.spi

## Interface Interceptor<T>

- Type Parameters:
    `T` - the interceptor bean class
  All Superinterfaces:
    Bean<T>, BeanAttributes<T>, Contextual<T>

      public interface Interceptor<T>
      extends Bean<T>

  Represents an enabled interceptor.

  Author:
    Gavin King, Pete Muir, David Allen

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<Annotation>` | `getInterceptorBindings()` Obtains the interceptor bindings of the interceptor.
    `Object` | `intercept(InterceptionType type, T instance, InvocationContext ctx)` Invokes the specified kind of lifecycle callback or method invocation interception upon the given interceptor instance.
    `boolean` | `intercepts(InterceptionType type)` Determines if the interceptor intercepts the specified kind of lifecycle callback or method invocation.

    - ### Methods inherited from interface javax.enterprise.inject.spi.Bean

      `getBeanClass, getInjectionPoints, isNullable`

    - ### Methods inherited from interface javax.enterprise.context.spi.Contextual

      `create, destroy`

    - ### Methods inherited from interface javax.enterprise.inject.spi.BeanAttributes

      `getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative`

- - ### Method Detail

    - #### getInterceptorBindings

          Set<Annotation> getInterceptorBindings()

      Obtains the interceptor bindings of the interceptor.

      Returns:
        the set of interceptor bindings

    - #### intercepts

          boolean intercepts(InterceptionType type)

      Determines if the interceptor intercepts the specified kind of lifecycle callback or method invocation.

      Parameters:
        `type` - the kind of interception
      Returns:
        returns `true` if the interceptor intercepts callbacks or business methods of the given type, and `false` otherwise.

    - #### intercept

          Object intercept(InterceptionType type,
                         T instance,
                         InvocationContext ctx)
                           throws Exception

      Invokes the specified kind of lifecycle callback or method invocation interception upon the given interceptor instance.

      Parameters:
        `type` - the kind of interception
        `instance` - the interceptor instance to invoke
        `ctx` - the context for the invocation
      Returns:
        the invocation return value
      Throws:
        `Exception` - thrown by the target method and/or the following interceptors in the chain

Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.