Class QMenuItemMatcher

java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.menus.adjusters.QMenuItemMatcher

public class QMenuItemMatcher extends Object
Utility class for matching menu items based on various criteria.

This class provides a flexible way to identify menu items within a menu structure. It supports matching by:

  • Exact item instance equality
  • Built-in option type (for QMenuItemBuiltIn items)
  • Item class type
  • Label text using filter criteria operators

Used primarily by QMenuAdjuster to locate items for modification or removal operations.

See Also:
  • Constructor Details

    • QMenuItemMatcher

      public QMenuItemMatcher(QMenuItemInterface item)
      Constructor that matches items by exact instance equality.
      Parameters:
      item - the specific menu item instance to match
    • QMenuItemMatcher

      public QMenuItemMatcher(QMenuItemBuiltIn.BuiltInOptionInterface builtInOption)
      Constructor that matches built-in menu items by their option type.
      Parameters:
      builtInOption - the built-in option to match (e.g., NEW, EDIT, DELETE)
    • QMenuItemMatcher

      public QMenuItemMatcher(Class<? extends QMenuItemInterface> menuItemClass)
      Constructor that matches items by their class type.
      Parameters:
      menuItemClass - the class type to match (e.g., QMenuItemDivider.class)
    • QMenuItemMatcher

      public QMenuItemMatcher(String labelValue)
      Constructor that matches items by label (doing an EQUALS match)
      Parameters:
      labelValue - the label value to match against
    • QMenuItemMatcher

      public QMenuItemMatcher(QCriteriaOperator operator, String labelValue)
      Constructor that matches items by label text using a filter criteria operator.
      Parameters:
      operator - the comparison operator (e.g., EQUALS, CONTAINS)
      labelValue - the label value to match against
  • Method Details

    • doesItemMatch

      public boolean doesItemMatch(QMenuItemInterface item)
      Determines whether the given menu item matches this matcher's criteria.

      The method checks the item against all configured matching criteria (instance, built-in option, class type, or label). Returns true if any of the configured criteria match.

      Parameters:
      item - the menu item to test
      Returns:
      true if the item matches this matcher's criteria, false otherwise