Interface IDhApiEventInjector

All Superinterfaces:
IDependencyInjector<IDhApiEvent>
All Known Implementing Classes:
ApiEventInjector

public interface IDhApiEventInjector extends IDependencyInjector<IDhApiEvent>
This class takes care of dependency injection for API events.
Since:
API 1.0.0
  • Method Details

    • unbind

      boolean unbind(Class<? extends IDhApiEvent> dependencyInterface, Class<? extends IDhApiEvent> dependencyClassToRemove) throws IllegalArgumentException
      Unlinks the given event handler, preventing the handler from being called in the future.
      Parameters:
      dependencyInterface - the base interface for the IDhApiEvent
      dependencyClassToRemove - the concrete IDhApiEvent class to remove
      Returns:
      true if the handler was unbound, false if the handler wasn't bound.
      Throws:
      IllegalArgumentException - if the implementation object doesn't implement the interface
    • fireAllEvents

      <T, U extends IDhApiEvent<T>> boolean fireAllEvents(Class<U> abstractEvent, T eventParameterObject)
      Fires all bound events of the given type (does nothing if no events are bound).
      Type Parameters:
      T - the parameter type taken by the event handlers.
      U - the IDhApiEvent's class
      Parameters:
      abstractEvent - event type
      eventParameterObject - event parameter
      Returns:
      if any of the bound event handlers notified that this event should be canceled.