Package org.camunda.commons.utils
Class EnsureUtil
java.lang.Object
org.camunda.commons.utils.EnsureUtil
- Direct Known Subclasses:
DomXmlEnsure
- Author:
- Stefan Hentschel.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
ensureNotNull
(String parameterName, Object value) Ensures that the parameter is not null.static <T> T
ensureParamInstanceOf
(String objectName, Object object, Class<T> type) Ensure the object is of a given type and return the casted object
-
Constructor Details
-
EnsureUtil
public EnsureUtil()
-
-
Method Details
-
ensureNotNull
Ensures that the parameter is not null.- Parameters:
parameterName
- the parameter namevalue
- the value to ensure to be not null- Throws:
IllegalArgumentException
- if the parameter value is null
-
ensureParamInstanceOf
Ensure the object is of a given type and return the casted object- Parameters:
objectName
- the name of the parameterobject
- the parameter valuetype
- the expected type- Returns:
- the parameter casted to the requested type
- Throws:
IllegalArgumentException
- in case object cannot be casted to type
-