java.lang.Object
overrungl.util.CheckUtil
CheckUtil relies on preview features of the Java platform:
CheckUtilrefers 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 voidcheck(boolean condition) Checks whether the given condition istrue.static voidChecks whether the given condition istrue.static voidChecks whether the given condition istrue.static voidChecks whether the given object is notnull.static voidcheckNotNull(Object o, String message) Checks whether the given object is notnull.static voidcheckNotNull(Object o, Supplier<String> messageSupplier) Checks whether the given object is notnull.static voidcheckNotNullptr(MemorySegmentPREVIEW segment) Checks whether the given segment is notNULL.static voidcheckNotNullptr(MemorySegmentPREVIEW segment, String message) Checks whether the given segment is notNULL.static voidcheckNotNullptr(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- ifconditionisfalse.- 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- ifconditionisfalse.- See Also:
-
check
Checks whether the given condition istrue.- Parameters:
condition- the condition.message- the message of the exception.- Throws:
IllegalStateException- ifconditionisfalse.- See Also:
-
checkNotNullptr
Checks whether the given segment is notNULL.- Parameters:
segment- the segment.- Throws:
IllegalStateException- ifsegmentisNULL.- 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- ifsegmentisNULL.- 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- ifsegmentisNULL.- See Also:
-
checkNotNull
Checks whether the given object is notnull.- Parameters:
o- the object.- Throws:
IllegalStateException- ifobjectisnull.- 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- ifobjectisnull.- See Also:
-
checkNotNull
Checks whether the given object is notnull.- Parameters:
o- the object.message- the message of the exception.- Throws:
IllegalStateException- ifobjectisnull.- See Also:
-
CheckUtilwhen preview features are enabled.