001    // Copyright 2004, 2005 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    package org.apache.tapestry.enhance;
015    
016    import java.lang.reflect.Method;
017    
018    
019    /**
020     * Service that provides a common interface to other lower level reflection services
021     * to provide a common set of functionality for reflection when using a 1.4 or >= 1.5 jre.
022     */
023    public interface ClassInspector
024    {
025    
026        /**
027         * Gets a compatible method signature for the specific generic {@link Method} object.
028         * 
029         * @param implementing
030         *          The class implmeneting the specific method.
031         * @param m
032         *      The method object to generate a signature for.
033         * @return A signature for the method.
034         */
035        MethodSignature getMethodSignature(Class implementing, Method m);
036        
037        /**
038         * Gets the first available method for the specified property. It may be a write or read method, but
039         * read will be preferred to write. 
040         * 
041         * @param type
042         *          The base class to introspect for the property accessor.
043         * @param propertyName
044         *          The name of the javabeans style property to look for. (ie "value" would be "getValue" )
045         *          
046         * @return A compatible method signature, or null if none could be found.
047         */
048        MethodSignature getPropertyAccessor(Class type, String propertyName);
049    }