Interface ClickCallback<T extends Audience>

Type Parameters:
T - audience type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ClickCallback<T extends Audience>
A handler for callback click events.
Since:
4.13.0
  • Field Details

    • DEFAULT_LIFETIME

      static final Duration DEFAULT_LIFETIME
      The default lifetime of a callback after creating it, 12 hours.
      Since:
      4.13.0
    • UNLIMITED_USES

      static final int UNLIMITED_USES
      Indicate that a callback should have unlimited uses.
      Since:
      4.13.0
      See Also:
  • Method Details

    • widen

      @CheckReturnValue @Contract(pure=true) static <W extends Audience, N extends W> ClickCallback<W> widen(ClickCallback<N> original, Class<N> type, @Nullable Consumer<? super Audience> otherwise)
      Adjust this callback to accept any audience, and perform the appropriate filtering.
      Type Parameters:
      W - the wider type
      N - the narrower type
      Parameters:
      original - the original callback of a narrower audience type
      type - the audience type to accept
      otherwise - the action to perform on the audience if it is not of the appropriate type
      Returns:
      a new callback
      Since:
      4.13.0
    • widen

      @CheckReturnValue @Contract(pure=true) static <W extends Audience, N extends W> ClickCallback<W> widen(ClickCallback<N> original, Class<N> type)
      Adjust this callback to accept any audience, and perform the appropriate filtering.

      No message will be sent if the audience is not of the appropriate type.

      Type Parameters:
      W - the wider type
      N - the narrower type
      Parameters:
      original - the original callback of a narrower audience type
      type - the audience type to accept
      Returns:
      a new callback
      Since:
      4.13.0
    • accept

      void accept(T audience)
      Perform an action for this event.
      Parameters:
      audience - the single-user audience who is attempting to execute this callback function.
      Since:
      4.13.0
    • filter

      @CheckReturnValue @Contract(pure=true) default ClickCallback<T> filter(Predicate<T> filter)
      Filter audiences that receive this click callback.

      Actions from audiences that do not match this predicate will be silently ignored.

      Parameters:
      filter - the filter to test audiences with
      Returns:
      a filtered callback action
      Since:
      4.13.0
    • filter

      @CheckReturnValue @Contract(pure=true) default ClickCallback<T> filter(Predicate<T> filter, @Nullable Consumer<? super Audience> otherwise)
      Filter audiences that receive this click callback.
      Parameters:
      filter - the filter to test audiences with
      otherwise - the action to perform on the audience if the conditions are not met
      Returns:
      a filtered callback action
      Since:
      4.13.0
    • requiringPermission

      @CheckReturnValue @Contract(pure=true) default ClickCallback<T> requiringPermission(String permission)
      Require that audiences receiving this callback have a certain permission.

      For audiences without permissions information, this test will always fail.

      Actions from audiences that do not match this predicate will be silently ignored.

      Parameters:
      permission - the permission to check
      Returns:
      a modified callback
      Since:
      4.13.0
    • requiringPermission

      @CheckReturnValue @Contract(pure=true) default ClickCallback<T> requiringPermission(String permission, @Nullable Consumer<? super Audience> otherwise)
      Require that audiences receiving this callback have a certain permission.

      For audiences without permissions information, this test will always fail.

      Parameters:
      permission - the permission to check
      otherwise - the action to perform on the audience if the conditions are not met
      Returns:
      a modified callback
      Since:
      4.13.0