Interface MenuSelector

All Known Implementing Classes:
RequestMenuSelector, TraversingMenuSelector

public interface MenuSelector
A MenuSelector is a strategy interface that searches a Menu tree and returns at most one Menu item that matches it.
  • Method Summary

    Modifier and Type
    Method
    Description
    byHttpServletRequest(@NonNull jakarta.servlet.http.HttpServletRequest request)
    Create a MenuSelector that will look for the item best matching the HttpServletRequest.
    byName(String name)
    Creates a MenuSelector that will look for the MenuItem with the given name.
    byPath(String path)
    Creates a MenuSelector that will look for the MenuItem with the given path.
    byTitle(String title)
    Creates a MenuSelector that will look for the MenuItem with the given title.
    Creates a MenuSelector that will look for the MenuItem with the given url.
    find(Menu menu)
    Search the given Menu for an item that matches the current selector.
  • Method Details

    • byHttpServletRequest

      static MenuSelector byHttpServletRequest(@NonNull @NonNull jakarta.servlet.http.HttpServletRequest request)
      Create a MenuSelector that will look for the item best matching the HttpServletRequest.
      Parameters:
      request - to match with
      Returns:
      selector
      See Also:
    • byPath

      static MenuSelector byPath(String path)
      Creates a MenuSelector that will look for the MenuItem with the given path.
      Parameters:
      path - Path to look for.
      Returns:
      MenuSelector instance.
    • byUrl

      static MenuSelector byUrl(String url)
      Creates a MenuSelector that will look for the MenuItem with the given url.
      Parameters:
      url - URL to look for.
      Returns:
      MenuSelector instance.
    • byName

      static MenuSelector byName(String name)
      Creates a MenuSelector that will look for the MenuItem with the given name.
      Parameters:
      name - Name to look for.
      Returns:
      MenuSelector instance.
    • byTitle

      static MenuSelector byTitle(String title)
      Creates a MenuSelector that will look for the MenuItem with the given title.
      Parameters:
      title - Title to look for.
      Returns:
      MenuSelector instance.
    • find

      Menu find(Menu menu)
      Search the given Menu for an item that matches the current selector.
      Parameters:
      menu - Menu tree to search top-down.
      Returns:
      Matching Menu item or null if not found.