Class Preconditions
- java.lang.Object
- 
- com.impossibl.postgres.protocol.sasl.scram.util.Preconditions
 
- 
 public class Preconditions extends Object Simple methods similar to Precondition class. Avoid importing full library.
- 
- 
Constructor SummaryConstructors Constructor Description Preconditions()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckArgument(boolean check, String valueName)Checks that the argument is valid, based in a check boolean condition.static StringcheckNotEmpty(String value, String valueName)Checks that the String is not null and not emptystatic <T> TcheckNotNull(T value, String valueName)Checks that the argument is not null.static intgt0(int value, String valueName)Checks that the integer argument is positive.
 
- 
- 
- 
Method Detail- 
checkNotNullpublic static <T> T checkNotNull(T value, String valueName) throws IllegalArgumentExceptionChecks that the argument is not null.- Type Parameters:
- T- The type of the value
- Parameters:
- value- The value to be checked
- valueName- The name of the value that is checked in the method
- Returns:
- The same value passed as argument
- Throws:
- IllegalArgumentException- If value is null
 
 - 
checkNotEmptypublic static String checkNotEmpty(String value, String valueName) throws IllegalArgumentException Checks that the String is not null and not empty- Parameters:
- value- The String to check
- valueName- The name of the value that is checked in the method
- Returns:
- The same String passed as argument
- Throws:
- IllegalArgumentException- If value is null or empty
 
 - 
checkArgumentpublic static void checkArgument(boolean check, String valueName) throws IllegalArgumentExceptionChecks that the argument is valid, based in a check boolean condition.- Parameters:
- check- The boolean check
- valueName- The name of the value that is checked in the method
- Throws:
- IllegalArgumentException
 
 - 
gt0public static int gt0(int value, String valueName) throws IllegalArgumentExceptionChecks that the integer argument is positive.- Parameters:
- value- The value to be checked
- valueName- The name of the value that is checked in the method
- Returns:
- The same value passed as argument
- Throws:
- IllegalArgumentException- If value is null
 
 
- 
 
-