com.mysema.commons.lang
Class Assert

java.lang.Object
  extended by com.mysema.commons.lang.Assert

public final class Assert
extends Object

General assertion utilities

Author:
sasa, tiwe

Method Summary
static
<T> T
assertThat(boolean condition, String propOrMsg, String msgSuffix, T rv)
          General assertion mwthos
static String hasLength(String str, String propOrMsg)
          Assert that the given String is not empty
static String hasText(String str, String propOrMsg)
          Assert that the given String has actual non-whitepsace text.
static boolean isFalse(boolean condition, String propOrMsg)
          Assert that the given condition is true
static boolean isTrue(boolean condition, String propOrMsg)
          Assert that the given condition is true
static
<C extends Collection<?>>
C
notEmpty(C col, String propOrMsg)
          Assert that the given Collection is not empty
static
<M extends Map<?,?>>
M
notEmpty(M map, String propOrMsg)
          Assert that the given Map is not empty
static
<T> T[]
notEmpty(T[] objects, String propOrMsg)
          Assert that the given array is not empty
static
<T> T
notNull(T object, String propOrMsg)
          Assert that the given object is not null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasText

public static String hasText(String str,
                             String propOrMsg)
Assert that the given String has actual non-whitepsace text.

Parameters:
str -
propOrMsg -
Returns:

notNull

public static <T> T notNull(T object,
                            String propOrMsg)
Assert that the given object is not null

Type Parameters:
T -
Parameters:
object -
propOrMsg -
Returns:

hasLength

public static String hasLength(String str,
                               String propOrMsg)
Assert that the given String is not empty

Parameters:
str -
propOrMsg -
Returns:

notEmpty

public static <T> T[] notEmpty(T[] objects,
                               String propOrMsg)
Assert that the given array is not empty

Type Parameters:
T -
Parameters:
objects -
propOrMsg -
Returns:

notEmpty

public static <M extends Map<?,?>> M notEmpty(M map,
                                              String propOrMsg)
Assert that the given Map is not empty

Type Parameters:
M -
Parameters:
map -
propOrMsg -
Returns:

notEmpty

public static <C extends Collection<?>> C notEmpty(C col,
                                                   String propOrMsg)
Assert that the given Collection is not empty

Type Parameters:
C -
Parameters:
col -
propOrMsg -
Returns:

isTrue

public static boolean isTrue(boolean condition,
                             String propOrMsg)
Assert that the given condition is true

Parameters:
condition -
propOrMsg -
Returns:

isFalse

public static boolean isFalse(boolean condition,
                              String propOrMsg)
Assert that the given condition is true

Parameters:
condition -
propOrMsg -
Returns:

assertThat

public static <T> T assertThat(boolean condition,
                               String propOrMsg,
                               String msgSuffix,
                               T rv)
General assertion mwthos

Type Parameters:
T -
Parameters:
condition -
propOrMsg -
msgSuffix -
rv -
Returns:


Copyright © 2008-2012 Mysema Ltd. All Rights Reserved.