Interface SubscriptionBuilder<T>

Type Parameters:
T - the handled / event type
All Known Subinterfaces:
MergedSubscriptionBuilder<T>, SingleSubscriptionBuilder<T>

public interface SubscriptionBuilder<T>
Abstract Subscription builder.
  • Field Details

  • Method Details

    • expireIf

      @NotNull @NotNull SubscriptionBuilder<T> expireIf(@NotNull @NotNull Predicate<T> predicate)
      Add a expiry predicate.
      Parameters:
      predicate - the expiry test
      Returns:
      ths builder instance
    • expireAfter

      @NotNull @NotNull SubscriptionBuilder<T> expireAfter(long duration, @NotNull @NotNull TimeUnit unit)
      Sets the expiry time on the handler
      Parameters:
      duration - the duration until expiry
      unit - the unit for the duration
      Returns:
      the builder instance
      Throws:
      IllegalArgumentException - if duration is not greater than or equal to 1
    • expireAfter

      @NotNull @NotNull SubscriptionBuilder<T> expireAfter(long maxCalls)
      Sets the number of calls until the handler will automatically be unregistered

      The call counter is only incremented if the event call passes all filters and if the handler completes without throwing an exception.

      Parameters:
      maxCalls - the number of times the handler will be called until being unregistered.
      Returns:
      the builder instance
      Throws:
      IllegalArgumentException - if maxCalls is not greater than or equal to 1
    • filter

      @NotNull @NotNull SubscriptionBuilder<T> filter(@NotNull @NotNull Predicate<T> predicate)
      Adds a filter to the handler.

      An event will only be handled if it passes all filters. Filters are evaluated in the order they are registered.

      Parameters:
      predicate - the filter
      Returns:
      the builder instance