package com.autonomy.abc.selenium.navigation;

import com.hp.autonomy.frontend.selenium.util.AppPage;
import org.openqa.selenium.WebDriver;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

// "typesafe heterogenous container" (Effective Java #29)
class PageMapper<T extends Enum<T> & PageMapper.Page> {
    private final Map<Class<?>, T> typeMap = new HashMap<>();

    // can access the enum value representing a page from
    // any of its superclasses, so that can e.g. access
    // PromotionsPage via either PromotionsPage or
    // HSOPromotionsPage depending on what is needed
    public PageMapper(Class<T> enumerator) {
        for (T page : EnumSet.allOf(enumerator)) {
            Class<?> type = page.getPageType();
            while (type != Object.class) {
                typeMap.put(type, page);
                type = type.getSuperclass();
            }
        }
    }

    T get(Class<?> type) {
        return typeMap.get(type);
    }

    public <S extends AppPage> S load(Class<S> type, WebDriver driver) {
        if (type.isAssignableFrom(typeMap.get(type).getPageType())) {
            @SuppressWarnings("unchecked")
            S value = (S) typeMap.get(type).loadAsObject(driver);
            return value;
        }
        return null;
    }

    interface Page {
        Class<?> getPageType();
        Object loadAsObject(WebDriver driver);
    }

    interface SwitchStrategy<T> {
        void switchUsing(T context);
    }
}

@@ -267,16 +267,23 @@
 va #29)%0A
+public 
 class Pa
@@ -1295,32 +1295,39 @@
 ull;%0A    %7D%0A%0A    
+public 
 interface Page %7B
@@ -1417,16 +1417,23 @@
  %7D%0A%0A    
+public 
 interfac

Make PageMapper and its interfaces public