T
- the type of the object the Assert
class verifies.public final class Assert<T> extends Object
Modifier and Type | Method and Description |
---|---|
T |
check()
Usage example:
Assert.create(Object object).notNull().ofClass(Class clazz).check() . |
static <T> Assert<T> |
create(T object) |
Assert<T> |
notNull()
Checks if the object is null, in which case an
IllegalArgumentException is thrown. |
Assert<?> |
ofClass(Class<?> clazz)
Checks if the object has a different type than the Class provided as parameter, in which case an
IllegalArgumentException is thrown. |
public static <T> Assert<T> create(T object)
T
- the type of the object the Assert
class verifies.object
- the object that will be checkedAssert
class.public Assert<T> notNull()
IllegalArgumentException
is thrown.Assert
instance, when no exception is thrown.public Assert<?> ofClass(Class<?> clazz)
IllegalArgumentException
is thrown.clazz
- the Class
against which the type of the object is checked.Assert
instance, when no exception is thrown.public T check()
Assert.create(Object object).notNull().ofClass(Class clazz).check()
.Assert
is created.Copyright © 2020. All rights reserved.