java.lang.Object
overrungl.util.CheckUtil
CheckUtil
relies on preview features of the Java platform:
CheckUtil
refers to one or more preview APIs:MemorySegment
.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
The check utilities.
- Since:
- 0.1.0
- Author:
- squid233
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
check
(boolean condition) Checks whether the given condition istrue
.static void
Checks whether the given condition istrue
.static void
Checks whether the given condition istrue
.static void
Checks whether the given object is notnull
.static void
checkNotNull
(Object o, String message) Checks whether the given object is notnull
.static void
checkNotNull
(Object o, Supplier<String> messageSupplier) Checks whether the given object is notnull
.static void
checkNotNullptr
(MemorySegmentPREVIEW segment) Checks whether the given segment is notNULL
.static void
checkNotNullptr
(MemorySegmentPREVIEW segment, String message) Checks whether the given segment is notNULL
.static void
checkNotNullptr
(MemorySegmentPREVIEW segment, Supplier<String> messageSupplier) Checks whether the given segment is notNULL
.
-
Method Details
-
check
Checks whether the given condition istrue
.- Parameters:
condition
- the condition.- Throws:
IllegalStateException
- ifcondition
isfalse
.- See Also:
-
check
public static void check(boolean condition, Supplier<String> messageSupplier) throws IllegalStateException Checks whether the given condition istrue
. The message of the exception is wrapped in a supplier to avoid side effect.- Parameters:
condition
- the condition.messageSupplier
- the message supplier of the exception.- Throws:
IllegalStateException
- ifcondition
isfalse
.- See Also:
-
check
Checks whether the given condition istrue
.- Parameters:
condition
- the condition.message
- the message of the exception.- Throws:
IllegalStateException
- ifcondition
isfalse
.- See Also:
-
checkNotNullptr
Checks whether the given segment is notNULL
.- Parameters:
segment
- the segment.- Throws:
IllegalStateException
- ifsegment
isNULL
.- See Also:
-
checkNotNullptr
public static void checkNotNullptr(MemorySegmentPREVIEW segment, Supplier<String> messageSupplier) throws IllegalStateException Checks whether the given segment is notNULL
. The message of the exception is wrapped in a supplier to avoid side effect.- Parameters:
segment
- the segment.messageSupplier
- the message supplier of the exception.- Throws:
IllegalStateException
- ifsegment
isNULL
.- See Also:
-
checkNotNullptr
public static void checkNotNullptr(MemorySegmentPREVIEW segment, String message) throws IllegalStateException Checks whether the given segment is notNULL
.- Parameters:
segment
- the segment.message
- the message of the exception.- Throws:
IllegalStateException
- ifsegment
isNULL
.- See Also:
-
checkNotNull
Checks whether the given object is notnull
.- Parameters:
o
- the object.- Throws:
IllegalStateException
- ifobject
isnull
.- See Also:
-
checkNotNull
public static void checkNotNull(Object o, Supplier<String> messageSupplier) throws IllegalStateException Checks whether the given object is notnull
. The message of the exception is wrapped in a supplier to avoid side effect.- Parameters:
o
- the object.messageSupplier
- the message supplier of the exception.- Throws:
IllegalStateException
- ifobject
isnull
.- See Also:
-
checkNotNull
Checks whether the given object is notnull
.- Parameters:
o
- the object.message
- the message of the exception.- Throws:
IllegalStateException
- ifobject
isnull
.- See Also:
-
CheckUtil
when preview features are enabled.