1 package com.atlassian.pageobjects;
2
3 /**
4 * Creates and binds the page objects to the page. Also supports special page navigation. Implementations should use
5 * any defined overrides in preference to passed class instances.
6 */
7 public interface PageBinder
8 {
9 /**
10 * Constructs the page object, changes the browser URL to the desired page URL, then binds the object to the page.
11 * @param pageClass The page class
12 * @param args Arguments to pass to the page object constructor.
13 * @param <P> The page type
14 * @return The constructed and fully loaded page with the browser set accordingly
15 */
16 <P extends Page> P navigateToAndBind(Class<P> pageClass, Object... args);
17
18 /**
19 * Builds and binds the page object to the page.
20 *
21 * @param pageClass The page object class
22 * @param args Arguments to pass to the page object constructor.
23 * @param <P> The page type
24 * @return The constructed and loaded page object with the browser set accordingly
25 */
26 <P> P bind(Class<P> pageClass, Object... args);
27
28 /**
29 * Creates a delayed binder that gives the caller full control over the lifecycle of the page object. The page
30 * object will not even be instantiated until the {@link DelayedBinder} methods are called.
31 * @param pageClass The page object class
32 * @param args The arguments to pass to the page object constructor
33 * @param <P> The page type
34 * @return A delayed binder instance
35 */
36 <P> DelayedBinder<P> delayedBind(Class<P> pageClass, Object... args);
37
38 /**
39 * Overrides a page object
40 * @param oldClass The old class that would have normally been constructed
41 * @param newClass An subclass of the old class to be substituted
42 * @param <P> The old class type
43 */
44 <P> void override(Class<P> oldClass, Class<? extends P> newClass);
45 }