Class EventHandler.Builder<T>

java.lang.Object
flare.eventbus.EventHandler.Builder<T>
Enclosing interface:
EventHandler<T>

public static class EventHandler.Builder<T> extends Object
  • Constructor Details

    • Builder

      protected Builder()
  • Method Details

    • filter

      public EventHandler.Builder<T> filter(Predicate<T> filter)
      Adds a filter to the executor of this listener. The executor will only be called if this condition passes on the given event.
    • ignoreCancelled

      public EventHandler.Builder<T> ignoreCancelled(boolean ignoreCancelled)
      Specifies if the handler should still be called if EventContext.isCancelled() returns true.

      Default is set to true.

      Parameters:
      ignoreCancelled - True to stop processing the event when cancelled
    • expirationCount

      public EventHandler.Builder<T> expirationCount(int expirationCount)
      Removes this listener after it has been executed the given number of times.
      Parameters:
      expirationCount - The number of times to execute
    • expireWhen

      public EventHandler.Builder<T> expireWhen(Predicate<T> expireWhen)
      Expires this listener when it passes the given condition. The expiration will happen before the event is executed.
      Parameters:
      expireWhen - The condition to test
    • build

      public EventHandler<T> build(BiConsumer<T,EventContext> handler)