001// Copyright 2008, 2011 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.ioc.services; 016 017import org.apache.tapestry5.ioc.AnnotationAccess; 018 019/** 020 * A decorator used to create an interceptor that delegates each method's invocation to an 021 * {@link org.apache.tapestry5.plastic.MethodAdvice} for advice. Advice can inspect or change method parameters, inspect or 022 * change the method's return value, and inspect and change thrown exceptions (checked and unchecked). 023 */ 024public interface AspectDecorator 025{ 026 /** 027 * Creates a builder that can be used to create the interceptor. This is used when only some of the methods need to 028 * be advised, or when different methods need to receive different advice, or when multiple advice is to be 029 * applied. 030 * 031 * @param serviceInterface defines the interface of the interceptor and the delegate 032 * @param delegate the object on which methods will be invokes 033 * @param description used as the toString() of the interceptor unless toString() is part of the service 034 * interface 035 * @param <T> the type of the service interface. 036 * @return a builder that can be used to generate the final interceptor 037 */ 038 <T> AspectInterceptorBuilder<T> createBuilder(Class<T> serviceInterface, T delegate, String description); 039 040 /** 041 * Creates a builder that can be used to create the interceptor. This is used when only some of the methods need to 042 * be advised, or when different methods need to receive different advice, or when multiple advice is to be 043 * applied. 044 * 045 * @param serviceInterface defines the interface of the interceptor and the delegate 046 * @param delegate the object on which methods will be invokes 047 * @param annotationAccess provides access to combined annotations of the underlying service 048 * and service interface 049 * @param description used as the toString() of the interceptor unless toString() is part of the service 050 * interface 051 * @param <T> the type of the service interface. 052 * @return a builder that can be used to generate the final interceptor 053 */ 054 <T> AspectInterceptorBuilder<T> createBuilder(Class<T> serviceInterface, T delegate, 055 AnnotationAccess annotationAccess, String description); 056}