Runner
| Type | 🔵 Class |
| Package | io.github.mrtesz.teszcore.logged |
| GitHub | Runner.java |
| Implements | Copyable<Runner> |
Description
Utility class for running <abbr title=java.lang.Runnable>Runnable</abbr>s and <abbr title=java.util.function.Supplier>Supplier</abbr>s with wrapping logging
Constructor
Runner(String usingProject);
Runner(String usingProject, TeszCoreLogger logger);
| Parameter | Type | Annotations | Description |
|---|---|---|---|
usingProject | String | @Nullable | The name of the project, using the Runner |
logger | TeszCoreLogger | @NotNull | (optional) Logger, the messages are sent in. Default: Logger at level 5 |
Methods
executeSupply
static <T> T executeSupply(Supplier<T> supplier, String extraInfo, String usingProject, TeszCoreLogger logger);
static <T> T executeSupply(Supplier<T> supplier, String extraInfo, String usingProject);
static <T> T executeSupply(Supplier<T> supplier, String extraInfo);
static <T> T executeSupply(Supplier<T> supplier);
Execute a <abbr title=java.util.function.Supplier>Supplier</abbr> with wrapping logging
| Parameter | Type | Annotations | Description |
|---|---|---|---|
supplier | Supplier<T> | @NotNull | The Supplier to execute |
extraInfo | String | @Nullable | (optional) Extra infos (for logging) |
usingProject | String | @Nullable | (optional) The name of the project, using the Runner |
logger | TeszCoreLogger | @NotNull | (optional) The logger, the messages are logged in |
executeSupply
static void executeRunnable(Runnable runnable, String extraInfo, String usingProject, TeszCoreLogger logger);
static void executeRunnable(Runnable runnable, String extraInfo, String usingProject);
static void executeRunnable(Runnable runnable, String extraInfo);
static void executeRunnable(Runnable runnable);
Run a <abbr title=java.lang.Runnable>Runnable</abbr> with wrapping logging
| Parameter | Type | Annotations | Description |
|---|---|---|---|
runnable | Runnable | @NotNull | The Runnable to execute |
extraInfo | String | @Nullable | (optional) Extra infos (for logging) |
usingProject | String | @Nullable | (optional) The name of the project, using the Runner |
logger | TeszCoreLogger | @NotNull | (optional) The logger, the messages are logged in |
get
<T> T get(Supplier<T> supplier, String extraInfo);
<T> T get(Supplier<T> supplier);
See #executeSupply
| Parameter | Type | Annotations | Description |
|---|---|---|---|
supplier | Supplier<T> | @NotNull | The Supplier to execute |
extraInfo | String | @Nullable | (optional) Extra infos (for logging) |
Returns: T — the supplied value
get
void run(Runnable runnable, String extraInfo);
void run(Runnable runnable);
See #executeRunnable
| Parameter | Type | Annotations | Description |
|---|---|---|---|
runnable | Runnable | @NotNull | The Runnable to run |
extraInfo | String | @Nullable | (optional) Extra infos (for logging) |
copy
implemented from Copyable.java
T: Runner