Package org.springframework.scheduling.config

# Class Task

java.lang.Object
org.springframework.scheduling.config.Task

Direct Known Subclasses:
  `DelayedTask`, `TriggerTask`

public class Task extends Object
Holder class defining a `Runnable` to be executed as a task, typically at a scheduled time or interval. See subclass hierarchy for various scheduling approaches.

Since:
  3.2
Author:
  Chris Beams, Juergen Hoeller, Brian Clozel

## Constructor Summary

Constructors
Constructor
Description
`Task(Runnable runnable)`
Create a new `Task`.

## Method Summary

Modifier and Type
Method
Description
`TaskExecutionOutcome`
`getLastExecutionOutcome()`
Return the outcome of the last task execution.
`Runnable`
`getRunnable()`
Return the underlying task.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### Task

public Task(Runnable runnable)
Create a new `Task`.

Parameters:
  `runnable` - the underlying task to execute

## Method Details

### getRunnable

public Runnable getRunnable()
Return the underlying task.

### getLastExecutionOutcome

public TaskExecutionOutcome getLastExecutionOutcome()
Return the outcome of the last task execution.

Since:
  6.2

### toString

public String toString()

Overrides:
  `toString` in class `Object`