Invocation API 1.1.0.Final

org.jboss.invocation
Class Interceptors

java.lang.Object
  extended by org.jboss.invocation.Interceptors

public final class Interceptors
extends Object

Interceptor utility and factory methods.

Author:
David M. Lloyd

Method Summary
static Interceptor getChainedInterceptor(Collection<Interceptor> instances)
          Get a chained interceptor which passes the invocation through the given interceptors.
static Interceptor getChainedInterceptor(Interceptor... instances)
          Get a chained interceptor which passes the invocation through the given interceptors.
static InterceptorFactory getChainedInterceptorFactory(Collection<InterceptorFactory> instances)
          Get a chained interceptor which passes the invocation through the given interceptors.
static InterceptorFactory getChainedInterceptorFactory(InterceptorFactory... instances)
          Get a chained interceptor factory which builds a chained interceptor using the given factories.
static Interceptor getInitialInterceptor()
          Get an interceptor that is always invoked first.
static InterceptorFactory getInitialInterceptorFactory()
          Get the interceptor factory for the initial interceptor.
static Interceptor getInvokingInterceptor()
          Get an invoking interceptor which always terminates.
static InterceptorFactory getInvokingInterceptorFactory()
          Get a factory which returns the invoking interceptor.
static Interceptor getTerminalInterceptor()
          Get an interceptor which always returns null.
static InterceptorFactory getTerminalInterceptorFactory()
          Get a factory which returns the terminal interceptor.
static Interceptor getWeavedInterceptor(Interceptor... interceptors)
           
static Exception rethrow(Throwable throwable)
          Convenience method to get a Throwable as an Exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInitialInterceptor

public static Interceptor getInitialInterceptor()
Get an interceptor that is always invoked first. This interceptor is responsible for correctly handling any initialization and cleanup for the interceptor chain. For example, this interceptor is responsible for handling undeclared checked exceptions.

Returns:
the interceptor

getInitialInterceptorFactory

public static InterceptorFactory getInitialInterceptorFactory()
Get the interceptor factory for the initial interceptor.

Returns:
the factory

getTerminalInterceptor

public static Interceptor getTerminalInterceptor()
Get an interceptor which always returns null.

Returns:
the interceptor

getTerminalInterceptorFactory

public static InterceptorFactory getTerminalInterceptorFactory()
Get a factory which returns the terminal interceptor.

Returns:
the factory

getInvokingInterceptor

public static Interceptor getInvokingInterceptor()
Get an invoking interceptor which always terminates. If the invoked method is null, this interceptor returns null, making it suitable for terminating lifecycle interceptor chains as well as invocation interceptor chains.

Returns:
the interceptor

getInvokingInterceptorFactory

public static InterceptorFactory getInvokingInterceptorFactory()
Get a factory which returns the invoking interceptor.

Returns:
the factory

getChainedInterceptor

public static Interceptor getChainedInterceptor(Interceptor... instances)
Get a chained interceptor which passes the invocation through the given interceptors.

Parameters:
instances - the interceptors to pass through
Returns:
the chained interceptor

getChainedInterceptor

public static Interceptor getChainedInterceptor(Collection<Interceptor> instances)
Get a chained interceptor which passes the invocation through the given interceptors.

Parameters:
instances - the interceptors to pass through
Returns:
the chained interceptor

getChainedInterceptorFactory

public static InterceptorFactory getChainedInterceptorFactory(InterceptorFactory... instances)
Get a chained interceptor factory which builds a chained interceptor using the given factories.

Parameters:
instances - the interceptor factories to use
Returns:
the chained interceptor factory

getChainedInterceptorFactory

public static InterceptorFactory getChainedInterceptorFactory(Collection<InterceptorFactory> instances)
Get a chained interceptor which passes the invocation through the given interceptors.

Parameters:
instances - the interceptors to pass through
Returns:
the chained interceptor

getWeavedInterceptor

public static Interceptor getWeavedInterceptor(Interceptor... interceptors)

rethrow

public static Exception rethrow(Throwable throwable)
                         throws Error
Convenience method to get a Throwable as an Exception.

Parameters:
throwable - the throwable
Returns:
the exception to throw
Throws:
Error - if the throwable is an error type

Invocation API 1.1.0.Final

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.