001 // Copyright 2009 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
015 package org.apache.tapestry5.ioc;
016
017 import java.lang.reflect.Method;
018
019 /**
020 * Interface used with service advisor methods to define advice. Allows advice on specific methods, or on all methods.
021 */
022 public interface MethodAdviceReceiver
023 {
024 /**
025 * Adds advice for a specific method of the aspect interceptor being constructed.
026 *
027 * @param method method (of the interface for which an interceptor is being constructed) to be advised. Multiple
028 * advice is allowed for a single method; the advice will be executed in the order it is added.
029 * @param advice the advice for this particular method. Advice must be threadsafe.
030 */
031 void adviseMethod(Method method, MethodAdvice advice);
032
033 /**
034 * Advises <em>all</em> methods of the interface with the given advice.
035 */
036 void adviseAllMethods(MethodAdvice advice);
037
038 /**
039 * Returns the interface for which methods may be advised.
040 *
041 * @see org.apache.tapestry5.ioc.services.MethodIterator
042 * @since 5.1.0.0
043 */
044 Class getInterface();
045 }