org.camunda.commons.utils
Class EnsureUtil

java.lang.Object
  extended by org.camunda.commons.utils.EnsureUtil

public class EnsureUtil
extends Object

Author:
Stefan Hentschel.

Constructor Summary
EnsureUtil()
           
 
Method Summary
static 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnsureUtil

public EnsureUtil()
Method Detail

ensureNotNull

public static void ensureNotNull(String parameterName,
                                 Object value)
Ensures that the parameter is not null.

Parameters:
parameterName - the parameter name
value - the value to ensure to be not null
Throws:
IllegalArgumentException - if the parameter value is null

ensureParamInstanceOf

public static <T> T ensureParamInstanceOf(String objectName,
                                          Object object,
                                          Class<T> type)
Ensure the object is of a given type and return the casted object

Parameters:
objectName - the name of the parameter
object - the parameter value
type - the expected type
Returns:
the parameter casted to the requested type
Throws:
IllegalArgumentException - in case object cannot be casted to type


Copyright © 2015 camunda services GmbH. All rights reserved.