public static boolean checkMethodSignature ( final Method method , final List < WaveItem < ? > > wParams ) { boolean isCompliant = false ; final Type [ ] mParams = method . getGenericParameterTypes ( ) ; if ( wParams . isEmpty ( ) && Wave . class . isAssignableFrom ( ClassUtility . getClassFromType ( mParams [ 0 ] ) ) ) { isCompliant = true ; } else if ( mParams . length - 1 == wParams . size ( ) ) { // Flag used to skip a method not compliant boolean skipMethod = false ; // Check each parameter for ( int i = 0 ; ! skipMethod && i < mParams . length - 1 && ! isCompliant ; i ++ ) { if ( ! ClassUtility . getClassFromType ( mParams [ i ] ) . isAssignableFrom ( ClassUtility . getClassFromType ( wParams . get ( i ) . type ( ) ) ) ) { // This method has not the right parameters skipMethod = true ; } if ( i == mParams . length - 2 && Wave . class . isAssignableFrom ( ClassUtility . getClassFromType ( mParams [ i + 1 ] ) ) ) { // This method is compliant with wave type isCompliant = true ; } } } return isCompliant ; }
Compare method parameters with wave parameters .