Class EntityActionMap


public final class EntityActionMap
Stores the named EntityAction instances registered on an Entity. Provides registration, lookup and removal by name.
  • Method Details

    • register

      public EntityAction register(String name, Runnable action)
      Registers a new EntityAction backed by the supplied runnable.
      Parameters:
      name - the action name
      action - the runnable executed when the action is triggered
      Returns:
      the registered action, or null if the parameters are invalid
    • register

      public void register(EntityAction action)
      Registers the supplied EntityAction.
      Parameters:
      action - the action to register; ignored if null
    • unregister

      public void unregister(EntityAction action)
      Unregisters the supplied EntityAction.
      Parameters:
      action - the action to unregister; ignored if null
    • unregister

      public void unregister(String actionName)
      Unregisters the EntityAction with the supplied name.
      Parameters:
      actionName - the action name; ignored if blank
    • getActions

      public Collection<EntityAction> getActions()
      Returns an unmodifiable view of all registered actions.
      Returns:
      the registered actions
    • get

      public EntityAction get(String actionName)
      Returns the action registered under the supplied name.
      Parameters:
      actionName - the action name
      Returns:
      the action, or null if not found
    • exists

      public boolean exists(String actionName)
      Returns whether an action with the supplied name is registered.
      Parameters:
      actionName - the action name
      Returns:
      true if registered