Class WaitConditionInvocationHandler<C extends Conditions<?>>
- java.lang.Object
-
- org.fluentlenium.core.conditions.wait.WaitConditionInvocationHandler<C>
-
- Type Parameters:
C
- type of conditions
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class WaitConditionInvocationHandler<C extends Conditions<?>> extends java.lang.Object implements java.lang.reflect.InvocationHandler
Invocation handler used to wait for a particular conditions call.
-
-
Constructor Summary
Constructors Constructor Description WaitConditionInvocationHandler(java.lang.Class<C> conditionClass, FluentWait wait, java.lang.String context, java.util.function.Supplier<C> conditionSupplier)
Creates a new wait condition invocation handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected C
applyNegation(C conditions, boolean ignoreNegation)
Apply the current negation to the given conditionprotected C
conditions()
Get the underlying conditions of wait matcher.protected C
conditions(boolean ignoreNot)
Get the underlying conditions of wait matcher.java.lang.Object
invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
protected C
messageBuilder()
Builds a message builder proxy.protected C
messageBuilder(boolean ignoreNegation)
Builds a message builder proxy.protected java.util.function.Function<java.lang.String,java.lang.String>
messageCustomizer()
Build the final message from default message.protected void
until(C condition, C messageBuilder, java.util.function.Function<C,java.lang.Boolean> conditionFunction)
Perform the wait.protected void
until(java.util.function.Predicate<FluentControl> present, java.lang.String message)
Perform the wait.protected void
until(java.util.function.Predicate<FluentControl> present, java.util.function.Supplier<java.lang.String> messageSupplier)
Perform the wait.
-
-
-
Constructor Detail
-
WaitConditionInvocationHandler
public WaitConditionInvocationHandler(java.lang.Class<C> conditionClass, FluentWait wait, java.lang.String context, java.util.function.Supplier<C> conditionSupplier)
Creates a new wait condition invocation handler.- Parameters:
conditionClass
- condition classwait
- fluent waitcontext
- base context of generated message if condition is not verifiedconditionSupplier
- supplier of conditions
-
-
Method Detail
-
conditions
protected C conditions()
Get the underlying conditions of wait matcher.- Returns:
- underlying conditions.
-
conditions
protected C conditions(boolean ignoreNot)
Get the underlying conditions of wait matcher.- Parameters:
ignoreNot
- true if the negation should be ignored.- Returns:
- underlying conditions.
-
applyNegation
protected C applyNegation(C conditions, boolean ignoreNegation)
Apply the current negation to the given condition- Parameters:
conditions
- conditions.ignoreNegation
- true if the negation should be ignored.- Returns:
- conditions with the negation applied.
-
messageBuilder
protected C messageBuilder()
Builds a message builder proxy.- Returns:
- message builder proxy
-
messageBuilder
protected C messageBuilder(boolean ignoreNegation)
Builds a message builder proxy.- Parameters:
ignoreNegation
- true if the negation should be ignored.- Returns:
- message builder proxy
-
messageCustomizer
protected java.util.function.Function<java.lang.String,java.lang.String> messageCustomizer()
Build the final message from default message.- Returns:
- final message
-
until
protected void until(java.util.function.Predicate<FluentControl> present, java.lang.String message)
Perform the wait.- Parameters:
present
- predicate to wait for.message
- message to use.
-
until
protected void until(java.util.function.Predicate<FluentControl> present, java.util.function.Supplier<java.lang.String> messageSupplier)
Perform the wait.- Parameters:
present
- predicate to wait for.messageSupplier
- default message to use.
-
until
protected void until(C condition, C messageBuilder, java.util.function.Function<C,java.lang.Boolean> conditionFunction)
Perform the wait.- Parameters:
condition
- condition object to wait formessageBuilder
- message builder matching the condition objectconditionFunction
- condition function
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
- Specified by:
invoke
in interfacejava.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
-
-