Package ej.navigation

Interface PageFactory

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Page create​(int key, java.lang.Object argument)
      Creates the page identified by the given key, injecting the given per-navigation argument.
    • Method Detail

      • create

        Page create​(int key,
                    @Nullable
                    java.lang.Object argument)
             throws java.lang.IllegalArgumentException
        Creates the page identified by the given key, injecting the given per-navigation argument.

        Called by the navigator when a navigation pushes a new history entry (Navigator.navigateTo(int)) or replaces the active one (Navigator.replaceWith(int)); it is not called on back navigation, which re-shows the cached page. A fresh page is expected on each call; the returned page must not be null.

        The argument is the one the navigation carried, and is null when it carried none. A factory that resolves a key expecting an argument is responsible for checking what it received: the navigator neither inspects the argument nor matches it against the key.

        Parameters:
        key - the non-negative key of the page to create.
        argument - the argument the navigation carried, or null if it carried none.
        Returns:
        the page for the given key.
        Throws:
        java.lang.IllegalArgumentException - if the given key does not identify any page.