public static void checkWaveTypeContract(final Class<? extends Component> waveReadyClass, final WaveType... waveTypes) {

        // Perform the check only if Developer Mode is activated
        if (CoreParameters.DEVELOPER_MODE.get()) {

            for (final WaveType waveType : waveTypes) {

                String methodName = ClassUtility.underscoreToCamelCase(waveType.toString());

                final List<Method> methods = ClassUtility.retrieveMethodList(waveReadyClass, waveType.toString());

                final List<Method> annotatedMethods = ClassUtility.getAnnotatedMethods(waveReadyClass, OnWave.class).stream()
                                                                  .filter(m -> WaveTypeRegistry.getWaveType(m.getAnnotation(OnWave.class).value()) == waveType)
                                                                  .collect(Collectors.toList());

                if (methods.isEmpty() && annotatedMethods.isEmpty()) {
                    LOGGER.log(BROKEN_API_NO_METHOD, waveReadyClass.getSimpleName(), methodName);
                    LOGGER.log(WAVE_HANDLER_METHOD_REQUIRED, waveReadyClass.getSimpleName(), methodName, waveType.items());
                }

                // Check parameter only for a WaveType

                int methodParameters = 0;
                boolean hasCompliantMethod = false;

                // Remove Wave Item that are not parameters
                final List<WaveItem<?>> wParams = waveType.parameters();

                for (int j = 0; j < methods.size() && !hasCompliantMethod; j++) {
                    hasCompliantMethod = checkMethodSignature(methods.get(j), wParams);
                    if (!hasCompliantMethod) {
                        methodParameters = methods.get(j).getParameterTypes().length - 1; // Remove the wave parameters
                    }
                }

                if (!hasCompliantMethod) {
                    for (int j = 0; j < annotatedMethods.size() && !hasCompliantMethod; j++) {
                        hasCompliantMethod = checkMethodSignature(annotatedMethods.get(j), wParams);
                        if (!hasCompliantMethod) {
                            methodName = annotatedMethods.get(j).getName();
                            methodParameters = annotatedMethods.get(j).getParameterTypes().length - 1; // Remove the wave parameters
                        }
                    }
                }

                if (!hasCompliantMethod) {
                    LOGGER.log(BROKEN_API_WRONG_PARAMETERS, waveReadyClass.getSimpleName(), methodName,
                               waveType.items().size(), methodParameters);

                    LOGGER.log(WAVE_HANDLER_METHOD_REQUIRED, waveReadyClass.getSimpleName(), methodName, waveType.items());
                }
            }
        }
    }
public static void checkWaveTypeContract ( final Class < ? extends Component > waveReadyClass , final WaveType ... waveTypes ) { if ( CoreParameters . DEVELOPER_MODE . get ( ) ) { for ( final WaveType waveType : waveTypes ) { String methodName = ClassUtility . underscoreToCamelCase ( waveType . toString ( ) ) ; final List < Method > methods = ClassUtility . retrieveMethodList ( waveReadyClass , waveType . toString ( ) ) ; final List < Method > annotatedMethods = ClassUtility . getAnnotatedMethods ( waveReadyClass , OnWave . class ) . stream ( ) . filter ( m -> WaveTypeRegistry . getWaveType ( m . getAnnotation ( OnWave . class ) . value ( ) ) == waveType ) . collect ( Collectors . toList ( ) ) ; if ( methods . isEmpty ( ) && annotatedMethods . isEmpty ( ) ) { LOGGER . log ( BROKEN_API_NO_METHOD , waveReadyClass . getSimpleName ( ) , methodName ) ; LOGGER . log ( WAVE_HANDLER_METHOD_REQUIRED , waveReadyClass . getSimpleName ( ) , methodName , waveType . items ( ) ) ; } int methodParameters = 0 ; boolean hasCompliantMethod = false ; final List < WaveItem < ? > > wParams = waveType . parameters ( ) ; for ( int j = 0 ; j < methods . size ( ) && ! hasCompliantMethod ; j ++ ) { hasCompliantMethod = checkMethodSignature ( methods . get ( j ) , wParams ) ; if ( ! hasCompliantMethod ) { methodParameters = methods . get ( j ) . getParameterTypes ( ) . length - 1 ; } } if ( ! hasCompliantMethod ) { for ( int j = 0 ; j < annotatedMethods . size ( ) && ! hasCompliantMethod ; j ++ ) { hasCompliantMethod = checkMethodSignature ( annotatedMethods . get ( j ) , wParams ) ; if ( ! hasCompliantMethod ) { methodName = annotatedMethods . get ( j ) . getName ( ) ; methodParameters = annotatedMethods . get ( j ) . getParameterTypes ( ) . length - 1 ; } } } if ( ! hasCompliantMethod ) { LOGGER . log ( BROKEN_API_WRONG_PARAMETERS , waveReadyClass . getSimpleName ( ) , methodName , waveType . items ( ) . size ( ) , methodParameters ) ; LOGGER . log ( WAVE_HANDLER_METHOD_REQUIRED , waveReadyClass . getSimpleName ( ) , methodName , waveType . items ( ) ) ; } } } }
Check if wave Type contract is respected for the the given {@link EnhancedComponent} class.

Throws a Runtime exception is Wave Contract is broken.

@param waveReadyClass the {@link EnhancedComponent} class to check
@param waveTypes the contract to respect (could be several WaveType)