public static void verifyMethodSignature(Method method, Class<?> returnType, Class<?>... parameters) {
        if(method == null) {
                throw new IllegalArgumentException("Method is null");
        }
        if (!method.getReturnType().equals(returnType)) {
                throw new IllegalArgumentException("Method " + method + " return type " + method.getReturnType()
                        + " does not match: " + returnType);
        }
        Class<?>[] actualParameters = method.getParameterTypes();
        if (actualParameters.length != parameters.length) {
            throw new IllegalArgumentException("Method " + method + " number of parameters " + actualParameters.length
                    + " does not match: " + parameters.length);
        }
        if (!Arrays.equals(actualParameters,parameters)) {
            throw new IllegalArgumentException("Method " + method + " types of parameters "
                    + Arrays.toString(actualParameters) + " does not match: " + Arrays.toString(parameters));
        }
    }
public static void verifyMethodSignature ( Method method , Class < ? > returnType , Class < ? > ... parameters ) { if ( method == null ) { throw new IllegalArgumentException ( "Method is null" ) ; } if ( ! method . getReturnType ( ) . equals ( returnType ) ) { throw new IllegalArgumentException ( "Method " + method + " return type " + method . getReturnType ( ) + " does not match: " + returnType ) ; } Class < ? > [ ] actualParameters = method . getParameterTypes ( ) ; if ( actualParameters . length != parameters . length ) { throw new IllegalArgumentException ( "Method " + method + " number of parameters " + actualParameters . length + " does not match: " + parameters . length ) ; } if ( ! Arrays . equals ( actualParameters , parameters ) ) { throw new IllegalArgumentException ( "Method " + method + " types of parameters " + Arrays . toString ( actualParameters ) + " does not match: " + Arrays . toString ( parameters ) ) ; } }
Verify that the supplied method's signature matches return type and
parameters types

@param method
Method to inspect
@param returnType
Return type to match
@param parameters
Parameter types to match

@throws IllegalArgumentException
if method fails to match return type or parameters types