public final class PrintingUtils extends Object
This class contains utility methods to run lambda functions with the necessary LogFixture
boilerplate to print results to stdout for debugging purposes.
If you need to enable printing for more classes, simply add them to the LogFixture
constructed in printAndThrow(CheckedSupplier)
.
Constructor and Description |
---|
PrintingUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
print(Supplier<T> supplier)
Enables printing to stdout for lambda functions that do not throw exceptions.
|
static <T,E extends Exception> |
printAndThrow(CheckedSupplier<T,E> supplier)
Enables printing to stdout for lambda functions that throw an exception.
|
public static <T> T print(Supplier<T> supplier)
T
- The return type of the lambda function.supplier
- Lambda function to execute.public static <T,E extends Exception> T printAndThrow(CheckedSupplier<T,E> supplier) throws E extends Exception
T
- Return type of the lambda function.E
- Type of exception thrown.supplier
- Lambda function to execute.E
- An exception.E extends Exception
Copyright © 2021 The Apache Software Foundation. All rights reserved.