Class MenuItem

  • All Implemented Interfaces:
    MenuNode

    public abstract class MenuItem
    extends Object
    implements MenuNode
    A menu item.
    • Constructor Detail

      • MenuItem

        public MenuItem()
    • Method Detail

      • getParams

        @Nullable
        public abstract String getParams()
        Returns:
        the parameters for this menu item
      • filter

        public Optional<MenuNode> filter​(Predicate<MenuNode> predicate)
        Description copied from interface: MenuNode
        Filters all Menu nodes by applying the predicate to their items.
        Specified by:
        filter in interface MenuNode
        Parameters:
        predicate - Predicate to apply to the items
        Returns:
        the filtered menu node
      • getPath

        public Optional<List<String>> getPath​(String id)
        Description copied from interface: MenuNode
        Returns the path from this menu node to the menu with given ID.
        Specified by:
        getPath in interface MenuNode
        Parameters:
        id - the ID of the menu to look for
        Returns:
        Optional List of Strings of the IDs of the menus leading up to the specified id, or Optional.empty() if this menu does not contain a node with the specified ID
      • contains

        public boolean contains​(Predicate<MenuNode> predicate)
        Description copied from interface: MenuNode
        Checks if this Menu node contains a menu node matching the given predicate
        Specified by:
        contains in interface MenuNode
        Parameters:
        predicate - the predicate to match
        Returns:
        boolean true if it contains a matching node, else false
      • firstItem

        public Optional<MenuItem> firstItem()
        Description copied from interface: MenuNode
        Finds the first menu item in this menu node. If it is a menu, this is the first item of its first child.
        Specified by:
        firstItem in interface MenuNode
      • isMenu

        public boolean isMenu()
        Specified by:
        isMenu in interface MenuNode
        Returns:
        true if this is a menu, false if it is a menu item
      • getUrl

        public String getUrl()
        Returns:
        the URL of this menu item, which is the combination of its ID and its parameters.