Class RedisAssertions
java.lang.Object
org.springframework.data.redis.util.RedisAssertions
Abstract utility class for common assertions used in Spring Data Redis.
- Since:
- 3.1.0
- Author:
- John Blum
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
requireNonNull
(T target, String message, Object... arguments) Asserts the givenObject
is not null.static <T> T
requireNonNull
(T target, Supplier<String> message) Asserts the givenObject
is not null.static <T> T
requireNonNull
(T target, RedisAssertions.RuntimeExceptionSupplier cause) static <T> T
requireState
(T target, String message, Object... arguments) Asserts the givenObject
is not null.static <T> T
requireState
(T target, Supplier<String> message) Asserts the givenObject
is not null.
-
Constructor Details
-
RedisAssertions
public RedisAssertions()
-
-
Method Details
-
requireNonNull
Asserts the givenObject
is not null.- Type Parameters:
T
-type
ofObject
being asserted.- Parameters:
target
-Object
to evaluate.message
-String
containing the message for the thrown exception.arguments
- array ofObject
arguments used to format themessage
.- Returns:
- the given
Object
. - Throws:
IllegalArgumentException
- if thetarget
is null.- See Also:
-
requireNonNull
Asserts the givenObject
is not null. -
requireNonNull
public static <T> T requireNonNull(@Nullable T target, RedisAssertions.RuntimeExceptionSupplier cause) -
requireState
Asserts the givenObject
is not null.- Type Parameters:
T
-type
ofObject
being asserted.- Parameters:
target
-Object
to evaluate.message
-String
containing the message for the thrown exception.arguments
- array ofObject
arguments used to format themessage
.- Returns:
- the given
Object
. - Throws:
IllegalArgumentException
- if thetarget
is null.- See Also:
-
requireState
Asserts the givenObject
is not null.
-