View Javadoc

1   package com.atlassian.pageobjects;
2   
3   import com.atlassian.annotations.PublicApi;
4   
5   import javax.annotation.Nonnull;
6   import javax.annotation.concurrent.NotThreadSafe;
7   
8   /**
9    * A delayed binder that gives the caller full control over the creation and lifecycle of the page object.
10   */
11  @NotThreadSafe
12  @PublicApi
13  public interface DelayedBinder<T>
14  {
15      /**
16       * Instantiates, injects, and initialises the page object, but doesn't execute its lifecycle methods.
17       * 
18       * @return the binder for chaining
19       */
20      @Nonnull
21      DelayedBinder<T> inject();
22  
23      /**
24       * Builds the page object and executes its {@link @com.atlassian.pageobjects.binder.WaitUntil wait until} lifecycle
25       * methods.
26       *
27       * @return the binder for chaining
28       */
29      @Nonnull
30      DelayedBinder<T> waitUntil();
31  
32      /**
33       * Builds, waits for, and validates the state of the page object
34       * @return the binder for chaining
35       */
36      @Nonnull
37      DelayedBinder<T> validateState();
38  
39      /**
40       * Goes through the full binding, including lifecycle methods, to determine whether the page object can be bound.
41       *
42       * @return {@code true} if the binding was successful, in which case {@link #bind()} will return the page object
43       * instance without failing
44       */
45      boolean canBind();
46  
47      /**
48       * @return The current page object, building IT if necessary. If called before any other methods are called, it will
49       * return the instantiated object but with no injections or lifecycle methods called.
50       */
51      @Nonnull
52      T get();
53  
54      /**
55       * Builds, waits for, validates the state of, and returns the page object.
56       *
57       * @return The fully bound page object
58       */
59      @Nonnull
60      T bind();
61  }