org.castor.core.util
Class Assert

java.lang.Object
  extended by org.castor.core.util.Assert

public class Assert
extends Object

A helper class that defines a method used for validating the input arguments.

Since:
1.3.3
Version:
1.3.3
Author:
Jakub Narloch

Method Summary
static void notEmpty(String obj, String msg)
          Asserts that passed object instance is not null and not empty.
static void notNull(Object obj, String msg)
          Asserts that passed object instance is not null.
static void paramNotEmpty(String param, String paramName)
          Asserts that passed parameter is not null and not empty.
static void paramNotNull(Object param, String paramName)
          Asserts that passed parameter is not null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

paramNotNull

public static void paramNotNull(Object param,
                                String paramName)
Asserts that passed parameter is not null. In case it is, then an IllegalArgumentException is thrown.

Parameters:
param - the parameter to check
paramName - the parameter name
Throws:
IllegalArgumentException - if param is null

paramNotEmpty

public static void paramNotEmpty(String param,
                                 String paramName)
Asserts that passed parameter is not null and not empty. In case it is, then an IllegalArgumentException is thrown.

Parameters:
param - the parameter to check
paramName - the parameter name
Throws:
IllegalArgumentException - if param is null or empty string

notNull

public static void notNull(Object obj,
                           String msg)
Asserts that passed object instance is not null. In case it is, then an IllegalArgumentException is thrown.

Parameters:
obj - the object instance to check
msg - the error message to use
Throws:
IllegalArgumentException - if obj is null

notEmpty

public static void notEmpty(String obj,
                            String msg)
Asserts that passed object instance is not null and not empty. In case it is, then an IllegalArgumentException is thrown.

Parameters:
obj - the object instance to check
msg - the error message to use
Throws:
IllegalArgumentException - if obj is null or empty string


Copyright © 2013. All Rights Reserved.