File tree Expand file tree Collapse file tree
src/main/java/io/appium/java_client/functions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919import org .openqa .selenium .WebDriver ;
2020
21+ import java .util .Objects ;
22+ import java .util .Optional ;
23+ import java .util .function .Function ;
24+
2125/**
2226 * This is extended version of {@link org.openqa.selenium.support.ui.ExpectedCondition}. It is combined
2327 * with {@link java.util.function.Function}.
2731@ FunctionalInterface
2832public interface ExpectedCondition <T > extends org .openqa .selenium .support .ui .ExpectedCondition <T >,
2933 java .util .function .Function <WebDriver , T > {
34+
35+ @ Override default <V > Function <V , T > compose (Function <? super V , ? extends WebDriver > before ) {
36+ Objects .requireNonNull (before );
37+ return (V v ) -> {
38+ WebDriver driver = before .apply (v );
39+ return Optional .ofNullable (driver != null ? apply (driver ) : null ).orElse (null );
40+ };
41+ }
42+
43+ @ Override default <V > Function <WebDriver , V > andThen (Function <? super T , ? extends V > after ) {
44+ Objects .requireNonNull (after );
45+ return (WebDriver w ) -> {
46+ T result = apply (w );
47+ return Optional .ofNullable (result != null ? after .apply (result ) : null ).orElse (null );
48+ };
49+ }
3050}
You can’t perform that action at this time.
0 commit comments