org.apache.tapestry5.ioc.services
Interface AspectDecorator

All Known Implementing Classes:
AspectDecoratorImpl

public interface AspectDecorator

A decorator used to create an interceptor that delegates each method's invocation to an MethodAdvice for advice. Advice can inspect or change method parameters, inspect or change the method's return value, and inspect and change thrown exceptions (checked and unchecked).


Method Summary
<T> T
build(Class<T> serviceInterface, T delegate, MethodAdvice advice, String description)
          Intercepts method invocations on the delegate and passes them through the provided aspect.
<T> AspectInterceptorBuilder<T>
createBuilder(Class<T> serviceInterface, T delegate, AnnotationAccess annotationAccess, String description)
          Creates a builder that can be used to create the interceptor.
<T> AspectInterceptorBuilder<T>
createBuilder(Class<T> serviceInterface, T delegate, String description)
          Creates a builder that can be used to create the interceptor.
 

Method Detail

build

<T> T build(Class<T> serviceInterface,
            T delegate,
            MethodAdvice advice,
            String description)
Intercepts method invocations on the delegate and passes them through the provided aspect. Note that the advice must be thread-safe.

Parameters:
serviceInterface - defines the interface of the interceptor and delegate
delegate - the object on which methods will be invoked
advice - intercepts the method invocations on the delegate
description - used as the toString() of the returned interceptor, unless toString() is part of the service interface
Returns:
the interceptor, wrapping the delegate with all the advice

createBuilder

<T> AspectInterceptorBuilder<T> createBuilder(Class<T> serviceInterface,
                                              T delegate,
                                              String description)
Creates a builder that can be used to create the interceptor. This is used when only some of the methods need to be advised, or when different methods need to receive different advice, or when multiple advice is to be applied.

Parameters:
serviceInterface - defines the interface of the interceptor and the delegate
delegate - the object on which methods will be invokes
description - used as the toString() of the interceptor unless toString() is part of the service interface
Returns:
a builder that can be used to generate the final interceptor

createBuilder

<T> AspectInterceptorBuilder<T> createBuilder(Class<T> serviceInterface,
                                              T delegate,
                                              AnnotationAccess annotationAccess,
                                              String description)
Creates a builder that can be used to create the interceptor. This is used when only some of the methods need to be advised, or when different methods need to receive different advice, or when multiple advice is to be applied.

Parameters:
serviceInterface - defines the interface of the interceptor and the delegate
delegate - the object on which methods will be invokes
annotationAccess - provides access to combined annotations of the underlying service and service interface
description - used as the toString() of the interceptor unless toString() is part of the service interface
Returns:
a builder that can be used to generate the final interceptor


Copyright © 2003-2012 The Apache Software Foundation.