View Javadoc

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