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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Options to configure how a callback can be executed.
    static interface 
    A provider for actually producing click callbacks.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Duration
    The default lifetime of a callback after creating it, 12 hours.
    static final int
    Indicate that a callback should have unlimited uses.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(T audience)
    Perform an action for this event.
    default @NotNull ClickCallback<T>
    filter(@NotNull Predicate<T> filter)
    Filter audiences that receive this click callback.
    default @NotNull ClickCallback<T>
    filter(@NotNull Predicate<T> filter, @Nullable Consumer<? super Audience> otherwise)
    Filter audiences that receive this click callback.
    default @NotNull ClickCallback<T>
    requiringPermission(@NotNull String permission)
    Require that audiences receiving this callback have a certain permission.
    default @NotNull ClickCallback<T>
    requiringPermission(@NotNull String permission, @Nullable Consumer<? super Audience> otherwise)
    Require that audiences receiving this callback have a certain permission.
    static <W extends Audience, N extends W>
    @NotNull ClickCallback<W>
    widen(@NotNull ClickCallback<N> original, @NotNull Class<N> type)
    Adjust this callback to accept any audience, and perform the appropriate filtering.
    static <W extends Audience, N extends W>
    @NotNull ClickCallback<W>
    widen(@NotNull ClickCallback<N> original, @NotNull Class<N> type, @Nullable Consumer<? super Audience> otherwise)
    Adjust this callback to accept any audience, and perform the appropriate filtering.
  • 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) @NotNull static <W extends Audience, N extends W> @NotNull ClickCallback<W> widen(@NotNull @NotNull ClickCallback<N> original, @NotNull @NotNull Class<N> type, @Nullable @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) @NotNull static <W extends Audience, N extends W> @NotNull ClickCallback<W> widen(@NotNull @NotNull ClickCallback<N> original, @NotNull @NotNull 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(@NotNull 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) @NotNull default @NotNull ClickCallback<T> filter(@NotNull @NotNull 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) @NotNull default @NotNull ClickCallback<T> filter(@NotNull @NotNull Predicate<T> filter, @Nullable @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) @NotNull default @NotNull ClickCallback<T> requiringPermission(@NotNull @NotNull 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) @NotNull default @NotNull ClickCallback<T> requiringPermission(@NotNull @NotNull String permission, @Nullable @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