Interface Task.Builder

  • Enclosing interface:
    Task

    @NonExtendable
    public static interface Task.Builder
    Task builder.
    • Method Detail

      • sync

        @Contract("-> this")
        @NotNull
        @NotNull Task.Builder sync()
        Execute this task synchronously.
        Returns:
        this.
      • async

        @Contract("-> this")
        @NotNull
        @NotNull Task.Builder async()
        Execute this task asynchronously.
        Returns:
        this.
      • delay

        @Contract("_ -> this")
        @NotNull
        @NotNull Task.Builder delay​(@NotNull
                                    @NotNull Schedule delay)
        Execute this task after a delay.
        Parameters:
        delay - Delay schedule.
        Returns:
        this.
      • repeat

        @Contract("_ -> this")
        @NotNull
        @NotNull Task.Builder repeat​(@NotNull
                                     @NotNull Schedule repeat)
        Execute this task repeatedly.
        Parameters:
        repeat - Repeat schedule.
        Returns:
        this.
      • cancelWhen

        @Contract("_ -> this")
        @NotNull
        @NotNull Task.Builder cancelWhen​(@NotNull
                                         @NotNull BooleanSupplier cancelWhen)
        Cancel this task when this the supplier returns true.
        Parameters:
        cancelWhen - Cancel when.
        Returns:
        this.
      • cancelAfter

        @Contract("_ -> this")
        @NotNull
        @NotNull Task.Builder cancelAfter​(int cancelAfter)
        Cancel after cancelAfter executions.
        Parameters:
        cancelAfter - Cancel after.
        Returns:
        this.
      • build

        @Contract(value="-> new",
                  pure=true)
        @NotNull
        @NotNull Task build()
        Build task.
        Returns:
        new task.