001    // Copyright 2010, 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    
015    package org.apache.tapestry5.services;
016    
017    import org.apache.tapestry5.plastic.MethodHandle;
018    import org.apache.tapestry5.plastic.PlasticClass;
019    import org.apache.tapestry5.plastic.PlasticMethod;
020    
021    /**
022     * Represents a bridge to an object method, when that method may not be public. A MethodAccess object
023     * encapsulates the approach for invoking the method and capturing the result (either the return value,
024     * or the checked exception that is thrown).
025     *
026     * @see TransformMethod#getAccess()
027     * @see PlasticClass
028     * @see PlasticMethod
029     * @see MethodHandle
030     * @since 5.2.0
031     * @deprecated Deprecated in 5.3
032     */
033    public interface MethodAccess
034    {
035        /**
036         * Invoke the method on the target, passing a number of arguments to the method.
037         * If the method throws a RuntimeException, that is passed through unchanged.
038         * If the method throws a checked exception, that will be reflected in the invocation result.
039         *
040         * @param target    object on which to invoke a method
041         * @param arguments arguments to pass to the method
042         */
043        MethodInvocationResult invoke(Object target, Object... arguments);
044    }