public class BambooPreconditions extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Exception> |
checkThat(boolean condition,
Function<String,T> exceptionSupplier,
String errorMessage,
Object... errorMessageArguments)
Check that a condition is met.
|
static <T extends Exception> |
checkThat(boolean condition,
Function<String,T> exceptionSupplier,
Supplier<String> errorMessageSupplier)
Check that a condition is met.
|
static <T extends Exception> |
checkThat(boolean condition,
Supplier<T> exceptionSupplier)
Check that a condition is met.
|
@Contract(value="false, _, _, _ -> fail") public static <T extends Exception> void checkThat(boolean condition, @NotNull Function<String,T> exceptionSupplier, @NotNull String errorMessage, @NotNull Object... errorMessageArguments) throws T extends Exception
T
- type of thrown exceptioncondition
- condition to checkexceptionSupplier
- a function which will be used to instantiate the exception using the given error
messageerrorMessage
- error message to pass to thrown exceptionerrorMessageArguments
- arguments used to format the error message (using String.format(String,
Object...)
method)T
- if the condition is not metT extends Exception
@Contract(value="false, _, _ -> fail") public static <T extends Exception> void checkThat(boolean condition, @NotNull Function<String,T> exceptionSupplier, @NotNull Supplier<String> errorMessageSupplier) throws T extends Exception
T
- type of thrown exceptioncondition
- condition to checkexceptionSupplier
- a function which will be used to instantiate the exception using the given error
messageerrorMessageSupplier
- a supplier that provides error message (can be used together with
TextProviderUtils.getTextSupplier())T
- if the condition is not metT extends Exception
@Contract(value="false, _ -> fail") public static <T extends Exception> void checkThat(boolean condition, @NotNull Supplier<T> exceptionSupplier) throws T extends Exception
If an exception with additional error message is preferred, use checkThat(boolean, Function, String,
Object...)
.
T
- type of thrown exceptioncondition
- condition to checkexceptionSupplier
- supplier for the exception to throwT
- if the condition is not metT extends Exception
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.