001// Copyright 2012 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.MethodAdviceReceiver;
018import org.apache.tapestry5.plastic.MethodAdvice;
019
020/**
021 * Used from a {@linkplain org.apache.tapestry5.ioc.annotations.Advise service advice method} to identify methods with the
022 * {@link org.apache.tapestry5.ioc.annotations.Operation} annotation, and add advice for those methods. This advice should typically
023 * be provided first, or nearly first, among all advice, to maximize the benefit of tracking operations.
024 *
025 * @since 5.4
026 */
027public interface OperationAdvisor
028{
029    /**
030     * Adds {@linkplain #createAdvice advice} to methods with the {@link org.apache.tapestry5.ioc.annotations.Operation} annotation.
031     */
032    void addOperationAdvice(MethodAdviceReceiver receiver);
033
034    /**
035     * Creates advice for a method.
036     *
037     * @param description the text (or format) used to display describe the operation for the method
038     * @return method advice
039     * @see org.apache.tapestry5.ioc.annotations.Operation#value()
040     */
041    MethodAdvice createAdvice(String description);
042}