Class Guard
java.lang.Object
com.github.martincooper.datatable.Guard
Guard class. Used to validate class arguments.
Created by Martin Cooper on 13/07/2017.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voiditemsNotNull(Iterable<T> argument, String name) Asserts the argument, and none of it's iterable items, is null.static <T> voiditemsNotNull(T[] argument, String name) Asserts the argument, and none of it's items, is null.static voidAsserts the value is not null.static <T> io.vavr.control.Try<T>tryNotNull(T argument, String name) Asserts the argument is not null.
-
Constructor Details
-
Guard
public Guard()
-
-
Method Details
-
notNull
Asserts the value is not null. Throws an IllegalArgumentException if it is.- Parameters:
argument- The argument to check.name- The name of the argument.
-
itemsNotNull
Asserts the argument, and none of it's iterable items, is null. Throws an IllegalArgumentException if it is.- Type Parameters:
T- The argument type.- Parameters:
argument- The argument to check.name- The name of the argument.
-
itemsNotNull
Asserts the argument, and none of it's items, is null. Throws an IllegalArgumentException if it is.- Type Parameters:
T- The argument type.- Parameters:
argument- The argument to check.name- The name of the argument.
-
tryNotNull
Asserts the argument is not null. Returns in a Try.- Type Parameters:
T- The argument type.- Parameters:
argument- The argument to check.name- The name of the argument.- Returns:
- Returns a Try testing the argument being null.
-