Package org.gradle.workers
Interface WorkAction<T extends WorkParameters>
-
- Type Parameters:
T- Parameter type for the work action. Should beWorkParameters.Noneif the action does not have parameters.
public interface WorkAction<T extends WorkParameters>Represents the implementation of a unit of work to be used when submitting work to theWorkerExecutor.A work action implementation is an abstract class implementing the
execute()method. A minimal implementation may look like this:import org.gradle.workers.WorkParameters; public abstract class MyWorkAction implements WorkAction<WorkParameters.None> { private final String greeting; @Inject public MyWorkAction() { this.greeting = "hello"; } @Override public void execute() { System.out.println(greeting); } }Implementations of WorkAction are subject to the following constraints:- Do not implement
getParameters()in your class, the method will be implemented by Gradle. - Constructors must be annotated with
Inject.
- Since:
- 5.6
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexecute()The work to perform when this work item executes.TgetParameters()The parameters associated with a concrete work item.
-
-
-
Method Detail
-
getParameters
@Inject T getParameters()
The parameters associated with a concrete work item.
-
execute
void execute()
The work to perform when this work item executes.
-
-