java.lang.Object
com.thecoderscorner.menu.domain.state.MenuState<T>
Type Parameters:
T - the type of current value.
All Implemented Interfaces:
AnyMenuState
Direct Known Subclasses:
BigDecimalMenuState, BooleanMenuState, CurrentScrollPositionMenuState, FloatMenuState, IntegerMenuState, PortableColorMenuState, StringListMenuState, StringMenuState

public abstract class MenuState<T> extends Object implements AnyMenuState
The base class of menu state, stores the value, if it's active and changed.
  • Constructor Details

    • MenuState

      public MenuState(AnyMenuState.StateStorageType storageType, MenuItem item, boolean changed, boolean active, T value)
      normally these states are created from the menu item, instead of directly
      Parameters:
      changed - if the item has changed
      active - if the item is active.
      value - the current value
  • Method Details

    • getItem

      public MenuItem getItem()
      Gets the menu item associated with this state.
      Specified by:
      getItem in interface AnyMenuState
      Returns:
      the menu item
    • getStorageType

      public AnyMenuState.StateStorageType getStorageType()
      The storage type for this state, eg if it is a MenuState specialised for Integer, then the state type will be INTEGER.
      Specified by:
      getStorageType in interface AnyMenuState
      Returns:
      the storage type
    • isChanged

      public boolean isChanged()
      gets the changed status
      Specified by:
      isChanged in interface AnyMenuState
      Returns:
      changed status
    • isActive

      public boolean isActive()
      gets the active status
      Specified by:
      isActive in interface AnyMenuState
      Returns:
      active status
    • getValue

      public T getValue()
      gets the current value
      Specified by:
      getValue in interface AnyMenuState
      Returns:
      current value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object