com.cgiams.esl.common.util
Class ValidationUtil

java.lang.Object
  extended bycom.cgiams.esl.common.util.ValidationUtil

public class ValidationUtil
extends java.lang.Object

This Singleton class provides common utility methods for validation. Rather than providing a class with static methods, this class is a Singleton so this class can eventually be mocked for future unit tests of other classes which may use this functionality.

Modification History
Programmer Date Description
Scott Bowers 04/06/2005 Original Author

Author:
sbowers

Field Summary
static java.lang.String DEFAULT_CLASSTYPE_MSG
          Default error message if none is provided.
static java.lang.String DEFAULT_ERROR_MSG
          Default error message if none is provided.
 
Method Summary
 void checkRequiredParm(java.lang.Object ao_param)
          Verifies that the incoming object is not null or blank making it a required field.
 void checkRequiredParm(java.lang.Object ao_param, java.lang.String as_error_msg)
          Verifies that the incoming object is not null or blank making it a required field.
static ValidationUtil getInstance()
          Return the Singleton instance of the ValidationUtil.
 void verifyParameterType(java.lang.Class ao_type, java.lang.Object ao_parm)
          Verify that the incoming parameter object's class type matches what is expected.
 void verifyParameterType(java.lang.Class ao_type, java.lang.Object ao_parm, java.lang.String as_message)
          Verify that the incoming parameter object's class type matches what is expected.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CLASSTYPE_MSG

public static final java.lang.String DEFAULT_CLASSTYPE_MSG
Default error message if none is provided.

See Also:
Constant Field Values

DEFAULT_ERROR_MSG

public static final java.lang.String DEFAULT_ERROR_MSG
Default error message if none is provided.

See Also:
Constant Field Values
Method Detail

getInstance

public static ValidationUtil getInstance()
Return the Singleton instance of the ValidationUtil.

Returns:
The singleton instance of the ValidationUtil class.

checkRequiredParm

public void checkRequiredParm(java.lang.Object ao_param)
                       throws java.lang.IllegalArgumentException
Verifies that the incoming object is not null or blank making it a required field. This also uses the default error message.

Parameters:
ao_param - Any object used as a parameter.
Throws:
java.lang.IllegalArgumentException - If the incoming parameter is null or blank.

checkRequiredParm

public void checkRequiredParm(java.lang.Object ao_param,
                              java.lang.String as_error_msg)
                       throws java.lang.IllegalArgumentException
Verifies that the incoming object is not null or blank making it a required field.

Parameters:
ao_param - Any object used as a parameter.
as_error_msg - The error message to display.
Throws:
java.lang.IllegalArgumentException - If the incoming parameter is null or blank.

verifyParameterType

public void verifyParameterType(java.lang.Class ao_type,
                                java.lang.Object ao_parm)
Verify that the incoming parameter object's class type matches what is expected. This method also implies that the parameter is required and if not found, a default error message is returned.

Parameters:
ao_type - The expected Class type for the parameter object.
ao_parm - The actual parameter object.

verifyParameterType

public void verifyParameterType(java.lang.Class ao_type,
                                java.lang.Object ao_parm,
                                java.lang.String as_message)
Verify that the incoming parameter object's class type matches what is expected. This method also implies that the parameter is required.

Parameters:
ao_type - The expected Class type for the parameter object.
ao_parm - The actual parameter object.
as_message - The message placed in the IllegalArgumentException.