All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fluentlenium.core.hook.HookControl Maven / Gradle / Ivy

package org.fluentlenium.core.hook;

import java.util.function.Function;

/**
 * Control interface for hooks.
 *
 * @param  self type
 */
public interface HookControl {
    /**
     * Disable all hooks from actual element.
     *
     * @return this object reference to chain calls
     */
    T noHook();

    /**
     * Disable given hook from actual element.
     *
     * @param hooks hook classes to disable
     * @return this object reference to chain calls
     */
    T noHook(Class... hooks);

    /**
     * Retore hooks that were defined initially.
     *
     * @return this object reference to chain calls
     */
    T restoreHooks();

    /**
     * Enable a hook with default options.
     *
     * @param hook hook class to enable
     * @param   Type of the hook
     * @param   Type of the hook options
     * @return this object reference to chain calls
     */
    > T withHook(Class hook);

    /**
     * Enable a hook with given options.
     *
     * @param hook    hook class to enable
     * @param options hook options to apply
     * @param      Type of the hook
     * @param      Type of the hook options
     * @return this object reference to chain calls
     */
    > T withHook(Class hook, O options);

    /**
     * Invoke a function with no hook.
     *
     * @param function function to invoke
     * @param       return type
     * @return return value of the given function
     */
     R noHook(Function function);

    /**
     * Invoke a function with no hook.
     *
     * @param hook     hook class to disable
     * @param function function to invoke
     * @param       return type
     * @return return value of the given function
     */
     R noHook(Class hook, Function function);

    /**
     * Creates a new element locator instance with all hooks disabled.
     *
     * @return new element locator with hook disabled.
     */
    T noHookInstance();

    /**
     * Creates a new element locator instance with given hook disabled.
     *
     * @param hooks hook classes to disable
     * @return new element locator with hook disabled.
     */
    T noHookInstance(Class... hooks);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy