Package com.mrivanplays.process
Class ResultedProcess<T>
java.lang.Object
com.mrivanplays.process.ResultedProcess<T>
- Type Parameters:
T
- result value type parameter
Represents a
Process
that has a result.- Since:
- 0.0.1
- Author:
- Ivan Pekov
-
Constructor Summary
ConstructorsConstructorDescriptionResultedProcess
(String identifier) Base constructor for allResultedProcess
implementations. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ResultedProcess<T>
fromSupplier
(String identifier, Supplier<T> supplier) Creates a newResultedProcess
from aSupplier
protected abstract T
run()
Main logic for running the process
-
Constructor Details
-
ResultedProcess
Base constructor for allResultedProcess
implementations.- Parameters:
identifier
- the identifier of this resulted process. It is good to set it every time implementation class(es) are created in order to properly defer results.
-
-
Method Details
-
fromSupplier
Creates a newResultedProcess
from aSupplier
- Type Parameters:
T
- result value type parameter- Parameters:
identifier
- resulted process identifiersupplier
- input supplier- Returns:
- resulted process
-
run
Main logic for running the process- Returns:
- a non null result value
- Throws:
Throwable
- if anything goes wrong, the implementation can throw any exception.
-