be.fgov.ehealth.etee.crypto.utils
Class Preconditions

java.lang.Object
  extended by be.fgov.ehealth.etee.crypto.utils.Preconditions

public final class Preconditions
extends java.lang.Object

Utility class to check method arguments for various conditions.


Method Summary
static java.util.Collection checkNotEmpty(java.util.Collection argument, java.lang.String message)
          Check if the given collection is not null or empty.
static java.lang.Object[] checkNotEmpty(java.lang.Object[] argument, java.lang.String message)
          Check if the given array is not null or empty.
static
<T> T
checkNotNull(T argument)
          Check if the given argument is not null.
static
<T> T
checkNotNull(T argument, java.lang.String message)
          Check if the given argument is not null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkNotNull

public static <T> T checkNotNull(T argument)
Check if the given argument is not null.

Type Parameters:
T - The type of the argument.
Parameters:
argument - The argument that needs to be checked.
Returns:
The argument, if not null
Throws:
java.lang.IllegalArgumentException - If the given argument is null.

checkNotNull

public static <T> T checkNotNull(T argument,
                                 java.lang.String message)
Check if the given argument is not null.

Type Parameters:
T - The type of the argument.
Parameters:
argument - The argument that needs to be checked.
message - The error message that should be given when the argument is null.
Returns:
The argument, if not null
Throws:
java.lang.IllegalArgumentException - If the given argument is null.

checkNotEmpty

public static java.util.Collection checkNotEmpty(java.util.Collection argument,
                                                 java.lang.String message)
Check if the given collection is not null or empty.

Parameters:
argument - The argument that needs to be checked.
message - The error message that should be given when the argument is null or empty.
Returns:
The argument, if not null
Throws:
java.lang.IllegalArgumentException - If the given argument is null or empty.

checkNotEmpty

public static java.lang.Object[] checkNotEmpty(java.lang.Object[] argument,
                                               java.lang.String message)
Check if the given array is not null or empty.

Parameters:
argument - The argument that needs to be checked.
message - The error message that should be given when the argument is null or empty.
Returns:
The argument, if not null
Throws:
java.lang.IllegalArgumentException - If the given argument is null or empty.


Copyright © 2019 eHealth. All Rights Reserved.