001package org.jadira.reflection.access.api;
002
003import java.lang.reflect.Method;
004
005/**
006 * Defines a mechanism for accessing a specific method within a specific class
007 * @param <C> The class containing the method to be accessed
008 */
009public interface MethodAccess<C> {      
010        
011        /**
012         * Get the Class containing the field being accessed
013         * @return The class
014         */
015        public Class<C> declaringClass();
016        
017        /**
018         * The Class giving the type of the method result or null
019         * @return The result class
020         */
021        public Class<?> returnClass();
022        
023        /**
024         * Get the Method being accessed
025         * @return The method
026         */
027        public Method method();
028        
029        /**
030         * Invokes the method
031         * @param parent The instance to access the method for
032         * @param args The arguments to supply when invoking the method
033         * @return The result of the method invocation, or null for a void method
034         */
035    Object invoke(C parent, Object ... args);
036}