Class AbstractMenuItemVisitor<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    MenuItemVisitor

    public abstract class AbstractMenuItemVisitor<T>
    extends java.lang.Object
    implements MenuItemVisitor
    Abstract version of the interface MenuItemVisitor, it implements all the methods by defaulting the behaviour to the anyItem() method.
    See Also:
    MenuItemVisitor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void anyItem​(MenuItem item)
      Whenever a visit method is not implemented, then anyItem is called instead.
      java.util.Optional<T> getResult()
      Returns the result previously stored by set result.
      protected void setResult​(T res)
      Stores the result within a visit call, normally used with visitWithResult
      void visit​(ActionMenuItem item)
      This will be called during visit for an action item
      void visit​(AnalogMenuItem item)
      This will be called during visit for an analog item
      void visit​(BooleanMenuItem item)
      This will be called during visit for a boolean item
      void visit​(EditableTextMenuItem item)
      This will be called during visit for a text item
      void visit​(EnumMenuItem item)
      This will be called during visit for an enumeration item
      void visit​(FloatMenuItem item)
      This will be called during visit for an floating point item
      void visit​(RuntimeListMenuItem listItem)
      this will be called during visit for a list item
      void visit​(SubMenuItem item)
      This will be called during visit for sub menu
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractMenuItemVisitor

        public AbstractMenuItemVisitor()
    • Method Detail

      • visit

        public void visit​(EnumMenuItem item)
        Description copied from interface: MenuItemVisitor
        This will be called during visit for an enumeration item
        Specified by:
        visit in interface MenuItemVisitor
        Parameters:
        item - the item
      • visit

        public void visit​(FloatMenuItem item)
        Description copied from interface: MenuItemVisitor
        This will be called during visit for an floating point item
        Specified by:
        visit in interface MenuItemVisitor
        Parameters:
        item - the item
      • anyItem

        public void anyItem​(MenuItem item)
        Whenever a visit method is not implemented, then anyItem is called instead. Default behaviour is to throw an exception.
        Parameters:
        item - the item
      • getResult

        public java.util.Optional<T> getResult()
        Returns the result previously stored by set result.
        Returns:
        the result or empty if not set.
        See Also:
        MenuItemHelper
      • setResult

        protected void setResult​(T res)
        Stores the result within a visit call, normally used with visitWithResult
        Parameters:
        res - the result to store
        See Also:
        MenuItemHelper