org.milyn.assertion
Class AssertArgument

java.lang.Object
  extended by org.milyn.assertion.AssertArgument

public abstract class AssertArgument
extends Object

Argument assertion utilities.

Author:
tfennelly

Constructor Summary
AssertArgument()
           
 
Method Summary
static void isInstanceOf(Object arg, Class<?> clazz, String argName)
          Assert that the argument is an instance of the specified class.
static void isNotEmpty(String arg, String argName)
          Assert that the argument is not empty.
static void isNotNull(Object arg, String argName)
          Assert that the argument is not null.
static void isNotNullAndNotEmpty(Collection<?> arg, String argName)
          Assert that the argument is neither null nor empty.
static void isNotNullAndNotEmpty(Map<?,?> arg, String argName)
          Assert that the argument is neither null nor empty.
static void isNotNullAndNotEmpty(Object[] arg, String argName)
          Assert that the argument is neither null nor empty.
static void isNotNullAndNotEmpty(String arg, String argName)
          Assert that the argument is neither null nor empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertArgument

public AssertArgument()
Method Detail

isNotNull

public static void isNotNull(Object arg,
                             String argName)
                      throws IllegalArgumentException
Assert that the argument is not null.

Parameters:
arg - Argument.
argName - Argument name.
Throws:
IllegalArgumentException - Argument is null.

isNotEmpty

public static void isNotEmpty(String arg,
                              String argName)
                       throws IllegalArgumentException
Assert that the argument is not empty.

Parameters:
arg - Argument.
argName - Argument name.
Throws:
IllegalArgumentException - Argument is not null, but is empty.

isNotNullAndNotEmpty

public static void isNotNullAndNotEmpty(String arg,
                                        String argName)
                                 throws IllegalArgumentException
Assert that the argument is neither null nor empty.

Parameters:
arg - Argument.
argName - Argument name.
Throws:
IllegalArgumentException - Argument is null or empty.

isNotNullAndNotEmpty

public static void isNotNullAndNotEmpty(Object[] arg,
                                        String argName)
                                 throws IllegalArgumentException
Assert that the argument is neither null nor empty.

Parameters:
arg - Argument.
argName - Argument name.
Throws:
IllegalArgumentException - Argument is null or empty.

isNotNullAndNotEmpty

public static void isNotNullAndNotEmpty(Collection<?> arg,
                                        String argName)
                                 throws IllegalArgumentException
Assert that the argument is neither null nor empty.

Parameters:
arg - Argument.
argName - Argument name.
Throws:
IllegalArgumentException - Argument is null or empty.

isNotNullAndNotEmpty

public static void isNotNullAndNotEmpty(Map<?,?> arg,
                                        String argName)
                                 throws IllegalArgumentException
Assert that the argument is neither null nor empty.

Parameters:
arg - Argument.
argName - Argument name.
Throws:
IllegalArgumentException - Argument is null or empty.

isInstanceOf

public static void isInstanceOf(Object arg,
                                Class<?> clazz,
                                String argName)
                         throws IllegalArgumentException
Assert that the argument is an instance of the specified class.

Parameters:
arg - Argument.
clazz - The Class type to check.
argName - Argument name.
Throws:
IllegalArgumentException - Argument is null or empty.


Copyright © 2018. All rights reserved.