Package io.fluentlenium.core.hook
Class HookControlImpl<T>
java.lang.Object
io.fluentlenium.core.hook.HookControlImpl<T>
- Type Parameters:
T- self type
- All Implemented Interfaces:
HookControl<T>
Control implementation for hooks.
-
Constructor Summary
ConstructorsConstructorDescriptionHookControlImpl(T self, Object proxy, FluentControl control, ComponentInstantiator instantiator, Supplier<T> noHookInstanceSupplier) Creates a new control implementation for hooks. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyHooks(Object proxy, HookChainBuilder hookChainBuilder, List<HookDefinition<?>> hookDefinitions) Apply defined hooks on the proxy.List<HookDefinition<?>>Get hook definitions.Stack<List<HookDefinition<?>>>Get hook restore stack.noHook()Disable all hooks from actual element.noHook(Class<? extends FluentHook>... hooks) Disable given hook from actual element.<R> RnoHook(Class<? extends FluentHook> hook, Function<T, R> function) Invoke a function with no hook.<R> RInvoke a function with no hook.Creates a new element locator instance with all hooks disabled.noHookInstance(Class<? extends FluentHook>... hooks) Creates a new element locator instance with given hook disabled.static voidremoveHooksFromDefinitions(Collection<HookDefinition<?>> definitions, Class<? extends FluentHook>... hooksToRemove) Removes hooks from definitions.Retore hooks that were defined initially.voidsetHookRestoreStack(Stack<List<HookDefinition<?>>> hookRestoreStack) Set the hook restore stack.<O,H extends FluentHook<O>>
TEnable a hook with default options.<O,H extends FluentHook<O>>
TEnable a hook with given options.
-
Constructor Details
-
HookControlImpl
public HookControlImpl(T self, Object proxy, FluentControl control, ComponentInstantiator instantiator, Supplier<T> noHookInstanceSupplier) Creates a new control implementation for hooks.- Parameters:
self- reference to object returned by chainnable callsproxy- proxy object to apply hooks oncontrol- control interfaceinstantiator- components instantiatornoHookInstanceSupplier- supplier of new instance without any hook.
-
-
Method Details
-
getHookDefinitions
Get hook definitions.- Returns:
- hook definitions
-
getHookRestoreStack
Get hook restore stack.- Returns:
- hook restore stack
-
setHookRestoreStack
Set the hook restore stack.- Parameters:
hookRestoreStack- hook restore stack
-
removeHooksFromDefinitions
public static void removeHooksFromDefinitions(Collection<HookDefinition<?>> definitions, Class<? extends FluentHook>... hooksToRemove) Removes hooks from definitions.- Parameters:
definitions- hook definitionshooksToRemove- hooks to remove
-
restoreHooks
Description copied from interface:HookControlRetore hooks that were defined initially.- Specified by:
restoreHooksin interfaceHookControl<T>- Returns:
- this object reference to chain calls
-
withHook
Description copied from interface:HookControlEnable a hook with default options.- Specified by:
withHookin interfaceHookControl<T>- Type Parameters:
O- Type of the hookH- Type of the hook options- Parameters:
hook- hook class to enable- Returns:
- this object reference to chain calls
-
withHook
Description copied from interface:HookControlEnable a hook with given options.- Specified by:
withHookin interfaceHookControl<T>- Type Parameters:
O- Type of the hookH- Type of the hook options- Parameters:
hook- hook class to enableoptions- hook options to apply- Returns:
- this object reference to chain calls
-
noHook
Description copied from interface:HookControlDisable all hooks from actual element.- Specified by:
noHookin interfaceHookControl<T>- Returns:
- this object reference to chain calls
-
noHook
Description copied from interface:HookControlDisable given hook from actual element.- Specified by:
noHookin interfaceHookControl<T>- Parameters:
hooks- hook classes to disable- Returns:
- this object reference to chain calls
-
applyHooks
protected void applyHooks(Object proxy, HookChainBuilder hookChainBuilder, List<HookDefinition<?>> hookDefinitions) Apply defined hooks on the proxy.- Parameters:
proxy- proxyhookChainBuilder- hook chain builderhookDefinitions- hook definitions
-
noHook
Description copied from interface:HookControlInvoke a function with no hook.- Specified by:
noHookin interfaceHookControl<T>- Type Parameters:
R- return type- Parameters:
function- function to invoke- Returns:
- return value of the given function
-
noHook
Description copied from interface:HookControlInvoke a function with no hook.- Specified by:
noHookin interfaceHookControl<T>- Type Parameters:
R- return type- Parameters:
hook- hook class to disablefunction- function to invoke- Returns:
- return value of the given function
-
noHookInstance
Description copied from interface:HookControlCreates a new element locator instance with all hooks disabled.- Specified by:
noHookInstancein interfaceHookControl<T>- Returns:
- new element locator with hook disabled.
-
noHookInstance
Description copied from interface:HookControlCreates a new element locator instance with given hook disabled.- Specified by:
noHookInstancein interfaceHookControl<T>- Parameters:
hooks- hook classes to disable- Returns:
- new element locator with hook disabled.
-