java.lang.Object
org.seppiko.commons.utils.Assert
Assert
- Author:
- Leonard Woo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidif string text length is 0 throw messagestatic voidif string text has not any char without whitespace throw messagestatic voidif true throw messagestatic voidif object is not null throw messagestatic voidif not true throw messagestatic voidif object array is null or length is 0 throw messagestatic voidif object is null throw messagestatic RuntimeExceptionThrow exception with RuntimeException
-
Constructor Details
-
Assert
public Assert()
-
-
Method Details
-
isTrue
if not true throw message- Parameters:
expression- boolean expressionmessage- message- Throws:
IllegalArgumentException- if expression is false throw this
-
isFalse
if true throw message- Parameters:
expression- boolean expressionmessage- message- Throws:
IllegalArgumentException- if expression is true throw this
-
isNull
if object is not null throw message- Parameters:
obj- objectmessage- message- Throws:
IllegalArgumentException- if object is not null throw this
-
notNull
if object is null throw message- Parameters:
obj- objectmessage- message- Throws:
IllegalArgumentException- if object is null throw this
-
hasLength
if string text length is 0 throw message- Parameters:
text- string textmessage- message- Throws:
IllegalArgumentException- if text have not any string throw this
-
hasText
if string text has not any char without whitespace throw message- Parameters:
text- string textmessage- message- Throws:
IllegalArgumentException- if text have not any char throw this
-
notEmpty
if object array is null or length is 0 throw message- Parameters:
array- object arraymessage- message- Throws:
IllegalArgumentException- if array is not empty throw this
-
sneakyThrow
Throw exception with RuntimeExceptiontry { throw new Throwable(); } catch (Throwable t) { throw Assert.sneakyThrow(t); }- Parameters:
t- any exception- Returns:
- RuntimeException
- Throws:
NullPointerException- if t is null throw this
-