org.gitective.core
Class Assert

java.lang.Object
  extended by org.gitective.core.Assert

public abstract class Assert
extends Object

Assert utilities that all throw IllegalArgumentException that will have a non-null/non-empty message.


Constructor Summary
Assert()
           
 
Method Summary
static String formatNotEmpty(String prefix)
          Return formatted not empty message with given prefix
static String formatNotNull(String prefix)
          Return formatted not null message with given prefix
static String notEmpty(String string)
          Throw an IllegalArgumentException with a default message if the string has a length of zero.
static String notEmpty(String message, String string)
          Throw an IllegalArgumentException with the message if the string has a length of zero.
static
<V> V[]
notEmpty(String message, V[] objects)
          Throw an IllegalArgumentException with the message if the Object array has a length of zero.
static
<V> V[]
notEmpty(V[] objects)
          Throw an IllegalArgumentException with a default message if the Object array has a length of zero.
static
<V> V
notNull(String message, V object)
          Throw an IllegalArgumentException with the message if the object is null.
static
<V> V
notNull(V object)
          Throw an IllegalArgumentException with a default message if the object is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assert

public Assert()
Method Detail

notNull

public static <V> V notNull(String message,
                            V object)
                 throws IllegalArgumentException
Throw an IllegalArgumentException with the message if the object is null.

Parameters:
message -
object -
Returns:
object
Throws:
IllegalArgumentException

notNull

public static <V> V notNull(V object)
                 throws IllegalArgumentException
Throw an IllegalArgumentException with a default message if the object is null.

Parameters:
object -
Returns:
object
Throws:
IllegalArgumentException

notEmpty

public static <V> V[] notEmpty(String message,
                               V[] objects)
                    throws IllegalArgumentException
Throw an IllegalArgumentException with the message if the Object array has a length of zero.

Parameters:
message -
objects -
Returns:
objects
Throws:
IllegalArgumentException

notEmpty

public static <V> V[] notEmpty(V[] objects)
                    throws IllegalArgumentException
Throw an IllegalArgumentException with a default message if the Object array has a length of zero.

Parameters:
objects -
Returns:
objects
Throws:
IllegalArgumentException

notEmpty

public static String notEmpty(String message,
                              String string)
                       throws IllegalArgumentException
Throw an IllegalArgumentException with the message if the string has a length of zero.

Parameters:
message -
string -
Returns:
string
Throws:
IllegalArgumentException

notEmpty

public static String notEmpty(String string)
                       throws IllegalArgumentException
Throw an IllegalArgumentException with a default message if the string has a length of zero.

Parameters:
string -
Returns:
string
Throws:
IllegalArgumentException

formatNotNull

public static String formatNotNull(String prefix)
Return formatted not null message with given prefix

Parameters:
prefix -
Returns:
non-null message

formatNotEmpty

public static String formatNotEmpty(String prefix)
Return formatted not empty message with given prefix

Parameters:
prefix -
Returns:
non-empty message


Copyright © 2011-2012. All Rights Reserved.