Package org.bonitasoft.engine.commons
Class NullCheckingUtil
java.lang.Object
org.bonitasoft.engine.commons.NullCheckingUtil
- Author:
- Elias Ricken de Medeiros
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents null value returned byfindNull(Object...). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbadStateIfNull(Object valueToCheck, String msg) This method throw an IllegalStateException if the given parameter is nullstatic voidbadStateIfTrue(boolean valueToCheck, String msg) This method throw an IllegalStateException if the given parameter is truestatic voidcheckArgsNotNull(Object... params) Check that the given parameters are not null.Find null parameters in the given list.static StackTraceElementgetCaller(int offset) Return the StackTraceElement at the given offset from this method invocation.
-
Constructor Details
-
NullCheckingUtil
public NullCheckingUtil()
-
-
Method Details
-
checkArgsNotNull
Check that the given parameters are not null. This method should only be used to check that some parameters given to a given method are not null. The exception message tries its best to produce a helpful message by scanning the stack trace.- Parameters:
params- the parameters to check- Throws:
IllegalArgumentException- if at least one of the parameters is null
-
findNull
Find null parameters in the given list. This method returns aNullCheckingUtil.NullCheckResult.- Parameters:
params- the parameters to check- Returns:
- a
NullCheckingUtil.NullCheckResultrepresenting null parameters. - See Also:
-
getCaller
Return the StackTraceElement at the given offset from this method invocation.- Parameters:
offset-- Returns:
- a StackTraceElement
-
badStateIfNull
This method throw an IllegalStateException if the given parameter is null- Parameters:
valueToCheck- the value to checkmsg- the message for the thrown exception- See Also:
-
badStateIfTrue
This method throw an IllegalStateException if the given parameter is true- Parameters:
valueToCheck- the value to checkmsg- the message for the thrown exception- See Also:
-