@Immutable public final class ValueEnforcer extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
isArrayOfsLen(boolean[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(byte[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(char[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(double[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(float[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(int[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(long[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(Object[] aArray,
int nOfs,
int nLen) |
static void |
isArrayOfsLen(short[] aArray,
int nOfs,
int nLen) |
static BigDecimal |
isBetweenExclusive(BigDecimal aValue,
String sName,
BigDecimal aLowerBoundExclusive,
BigDecimal aUpperBoundExclusive)
Check if
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive |
static BigInteger |
isBetweenExclusive(BigInteger aValue,
String sName,
BigInteger aLowerBoundExclusive,
BigInteger aUpperBoundExclusive)
Check if
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive |
static double |
isBetweenExclusive(double dValue,
String sName,
double dLowerBoundExclusive,
double dUpperBoundExclusive)
Check if
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive |
static float |
isBetweenExclusive(float fValue,
String sName,
float fLowerBoundExclusive,
float fUpperBoundExclusive)
Check if
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive |
static int |
isBetweenExclusive(int nValue,
String sName,
int nLowerBoundExclusive,
int nUpperBoundExclusive)
Check if
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive |
static long |
isBetweenExclusive(long nValue,
String sName,
long nLowerBoundExclusive,
long nUpperBoundExclusive)
Check if
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive |
static short |
isBetweenExclusive(short nValue,
String sName,
short nLowerBoundExclusive,
short nUpperBoundExclusive)
Check if
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive |
static BigDecimal |
isBetweenInclusive(BigDecimal aValue,
String sName,
BigDecimal aLowerBoundInclusive,
BigDecimal aUpperBoundInclusive)
Check if
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive |
static BigInteger |
isBetweenInclusive(BigInteger aValue,
String sName,
BigInteger aLowerBoundInclusive,
BigInteger aUpperBoundInclusive)
Check if
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive |
static double |
isBetweenInclusive(double dValue,
String sName,
double dLowerBoundInclusive,
double dUpperBoundInclusive)
Check if
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive |
static float |
isBetweenInclusive(float fValue,
String sName,
float fLowerBoundInclusive,
float fUpperBoundInclusive)
Check if
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive |
static int |
isBetweenInclusive(int nValue,
String sName,
int nLowerBoundInclusive,
int nUpperBoundInclusive)
Check if
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive |
static long |
isBetweenInclusive(long nValue,
String sName,
long nLowerBoundInclusive,
long nUpperBoundInclusive)
Check if
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive |
static short |
isBetweenInclusive(short nValue,
String sName,
short nLowerBoundInclusive,
short nUpperBoundInclusive)
Check if
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive |
static void |
isFalse(boolean bValue,
String sMsg)
Check that the passed value is
false. |
static BigDecimal |
isGE0(BigDecimal aValue,
String sName) |
static BigInteger |
isGE0(BigInteger aValue,
String sName) |
static double |
isGE0(double dValue,
String sName) |
static float |
isGE0(float fValue,
String sName) |
static int |
isGE0(int nValue,
String sName) |
static long |
isGE0(long nValue,
String sName) |
static short |
isGE0(short nValue,
String sName) |
static BigDecimal |
isGT0(BigDecimal aValue,
String sName) |
static BigInteger |
isGT0(BigInteger aValue,
String sName) |
static double |
isGT0(double dValue,
String sName) |
static float |
isGT0(float fValue,
String sName) |
static int |
isGT0(int nValue,
String sName) |
static long |
isGT0(long nValue,
String sName) |
static short |
isGT0(short nValue,
String sName) |
static BigDecimal |
isLE0(BigDecimal aValue,
String sName) |
static BigInteger |
isLE0(BigInteger aValue,
String sName) |
static double |
isLE0(double dValue,
String sName) |
static float |
isLE0(float fValue,
String sName) |
static int |
isLE0(int nValue,
String sName) |
static long |
isLE0(long nValue,
String sName) |
static short |
isLE0(short nValue,
String sName) |
static BigDecimal |
isLT0(BigDecimal aValue,
String sName) |
static BigInteger |
isLT0(BigInteger aValue,
String sName) |
static double |
isLT0(double dValue,
String sName) |
static float |
isLT0(float fValue,
String sName) |
static int |
isLT0(int nValue,
String sName) |
static long |
isLT0(long nValue,
String sName) |
static short |
isLT0(short nValue,
String sName) |
static void |
isNull(Object aValue,
String sName)
Check that the passed value is
null. |
static <T> T |
isSame(T aValue,
String sName,
T aExpectedValue)
Check that the passed value is the same as the provided expected value
using
== to check comparison. |
static void |
isTrue(boolean bValue,
String sMsg)
Check that the passed value is
true. |
static <T> T[] |
noNullValue(T[] aValue,
String sName)
Check that the passed Array contains no
null value. |
static <T extends Iterable<?>> |
noNullValue(T aValue,
String sName)
Check that the passed iterable contains no
null value. |
static <T extends Map<?,?>> |
noNullValue(T aValue,
String sName)
Check that the passed map is neither
null nor empty and that
no null key or value is contained. |
static boolean[] |
notEmpty(boolean[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static byte[] |
notEmpty(byte[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static char[] |
notEmpty(char[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static double[] |
notEmpty(double[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static float[] |
notEmpty(float[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static int[] |
notEmpty(int[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static long[] |
notEmpty(long[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static short[] |
notEmpty(short[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static <T> T[] |
notEmpty(T[] aValue,
String sName)
Check that the passed Array is neither
null nor empty. |
static <T extends CharSequence> |
notEmpty(T aValue,
String sName)
Check that the passed String is neither
null nor empty. |
static <T extends Iterable<?>> |
notEmpty(T aValue,
String sName)
Check that the passed
Iterable is neither null nor
empty. |
static <T extends Collection<?>> |
notEmpty(T aValue,
String sName)
Check that the passed
Collection is neither null nor
empty. |
static <T extends Map<?,?>> |
notEmpty(T aValue,
String sName)
Check that the passed Collection is neither
null nor empty. |
static <T> T[] |
notEmptyNoNullValue(T[] aValue,
String sName)
Check that the passed Array is neither
null nor empty and that
no null value is contained. |
static <T extends Iterable<?>> |
notEmptyNoNullValue(T aValue,
String sName)
Check that the passed collection is neither
null nor empty and
that no null value is contained. |
static <T extends Map<?,?>> |
notEmptyNoNullValue(T aValue,
String sName)
Check that the passed map is neither
null nor empty and that
no null value is contained. |
static <T> T |
notNull(T aValue,
String sName)
Check that the passed value is not
null. |
static <T> T |
notNullAndEquals(T aValue,
String sName,
T aExpectedValue)
Check that the passed value is not
null and equal to the
provided expected value. |
static <T> T[] |
notNullNoNullValue(T[] aValue,
String sName)
Check that the passed Array is not
null and that no
null value is contained. |
static <T extends Iterable<?>> |
notNullNoNullValue(T aValue,
String sName)
Check that the passed collection is not
null and that no
null value is contained. |
static <T extends Map<?,?>> |
notNullNoNullValue(T aValue,
String sName)
Check that the passed map is not
null and that no
null value is contained. |
static <T> T |
notNullNotEquals(T aValue,
String sName,
T aUnexpectedValue)
Check that the passed value is not
null and not equal to the
provided value. |
public static void isTrue(boolean bValue,
String sMsg)
true.bValue - The value to check.sMsg - The message to be emitted in case the value is falseIllegalArgumentException - if the passed value is not null.public static void isFalse(boolean bValue,
String sMsg)
false.bValue - The value to check.sMsg - The message to be emitted in case the value is trueIllegalArgumentException - if the passed value is not null.@Nonnull public static <T> T notNull(T aValue, String sName)
null.T - Type to be checked and returnedaValue - The value to check.sName - The name of the value (e.g. the parameter name)null.NullPointerException - if the passed value is null.@Nonnull public static void isNull(Object aValue, String sName)
null.aValue - The value to check.sName - The name of the value (e.g. the parameter name)IllegalArgumentException - if the passed value is not null.@Nonnull public static <T extends CharSequence> T notEmpty(T aValue, String sName)
null nor empty.T - Type to be checked and returnedaValue - The String to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static <T> T[] notEmpty(T[] aValue, String sName)
null nor empty.T - Type to be checked and returnedaValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static boolean[] notEmpty(boolean[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static byte[] notEmpty(byte[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static char[] notEmpty(char[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static double[] notEmpty(double[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static float[] notEmpty(float[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static int[] notEmpty(int[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static long[] notEmpty(long[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static short[] notEmpty(short[] aValue, String sName)
null nor empty.aValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static <T extends Collection<?>> T notEmpty(T aValue, String sName)
Collection is neither null nor
empty.T - Type to be checked and returnedaValue - The String to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static <T extends Iterable<?>> T notEmpty(T aValue, String sName)
Iterable is neither null nor
empty.T - Type to be checked and returnedaValue - The String to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nonnull public static <T extends Map<?,?>> T notEmpty(T aValue, String sName)
null nor empty.T - Type to be checked and returnedaValue - The String to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty@Nullable public static <T> T[] noNullValue(T[] aValue, String sName)
null value. But the
whole array can be null or empty.T - Type to be checked and returnedaValue - The Array to check. May be null.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is not empty and a null value is
contained@Nullable public static <T extends Iterable<?>> T noNullValue(T aValue, String sName)
null value. But the
whole iterable can be null or empty.T - Type to be checked and returnedaValue - The collection to check. May be null.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is not empty and a null value is
contained@Nullable public static <T extends Map<?,?>> T noNullValue(T aValue, String sName)
null nor empty and that
no null key or value is contained.T - Type to be checked and returnedaValue - The map to check. May be null.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is not empty and a null key or
null value is contained@Nonnull public static <T> T[] notNullNoNullValue(T[] aValue, String sName)
null and that no
null value is contained.T - Type to be checked and returnedaValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is null or a null value is
contained@Nonnull public static <T extends Iterable<?>> T notNullNoNullValue(T aValue, String sName)
null and that no
null value is contained.T - Type to be checked and returnedaValue - The collection to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is null or a null
value is contained@Nonnull public static <T extends Map<?,?>> T notNullNoNullValue(T aValue, String sName)
null and that no
null value is contained.T - Type to be checked and returnedaValue - The map to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is null or a null
value is contained@Nonnull public static <T> T[] notEmptyNoNullValue(T[] aValue, String sName)
null nor empty and that
no null value is contained.T - Type to be checked and returnedaValue - The Array to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty or a null value is
contained@Nonnull public static <T extends Iterable<?>> T notEmptyNoNullValue(T aValue, String sName)
null nor empty and
that no null value is contained.T - Type to be checked and returnedaValue - The collection to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty or a null value is
contained@Nonnull public static <T extends Map<?,?>> T notEmptyNoNullValue(T aValue, String sName)
null nor empty and that
no null value is contained.T - Type to be checked and returnedaValue - The map to check.sName - The name of the value (e.g. the parameter name)null.IllegalArgumentException - if the passed value is empty or a null value is
contained@Nonnull public static <T> T notNullNotEquals(@Nonnull T aValue, String sName, @Nonnull T aUnexpectedValue)
null and not equal to the
provided value.T - Type to be checked and returnedaValue - The value to check. May not be null.sName - The name of the value (e.g. the parameter name)aUnexpectedValue - The value that may not be equal to aValue. May not be
null.null.@Nonnull public static <T> T notNullAndEquals(T aValue, @Nonnull @Nonempty String sName, @Nonnull T aExpectedValue)
null and equal to the
provided expected value.T - Type to be checked and returnedaValue - The value to check.sName - The name of the value (e.g. the parameter name)aExpectedValue - The expected value. May not be null.null.IllegalArgumentException - if the passed value is not null.@Nullable public static <T> T isSame(T aValue, @Nonnull @Nonempty String sName, @Nullable T aExpectedValue)
== to check comparison.T - Type to be checked and returnedaValue - The value to check.sName - The name of the value (e.g. the parameter name)aExpectedValue - The expected value. May be null.null if the expected value
is null.IllegalArgumentException - if the passed value is not null.public static short isGE0(short nValue,
String sName)
public static int isGE0(int nValue,
String sName)
public static long isGE0(long nValue,
String sName)
public static double isGE0(double dValue,
String sName)
public static float isGE0(float fValue,
String sName)
@Nonnull public static BigDecimal isGE0(@Nonnull BigDecimal aValue, String sName)
@Nonnull public static BigInteger isGE0(@Nonnull BigInteger aValue, String sName)
public static short isGT0(short nValue,
String sName)
public static int isGT0(int nValue,
String sName)
public static long isGT0(long nValue,
String sName)
public static double isGT0(double dValue,
String sName)
public static float isGT0(float fValue,
String sName)
@Nonnull public static BigDecimal isGT0(@Nonnull BigDecimal aValue, String sName)
@Nonnull public static BigInteger isGT0(@Nonnull BigInteger aValue, String sName)
public static short isLE0(short nValue,
String sName)
public static int isLE0(int nValue,
String sName)
public static long isLE0(long nValue,
String sName)
public static double isLE0(double dValue,
String sName)
public static float isLE0(float fValue,
String sName)
@Nonnull public static BigDecimal isLE0(@Nonnull BigDecimal aValue, String sName)
@Nonnull public static BigInteger isLE0(@Nonnull BigInteger aValue, String sName)
public static short isLT0(short nValue,
String sName)
public static int isLT0(int nValue,
String sName)
public static long isLT0(long nValue,
String sName)
public static double isLT0(double dValue,
String sName)
public static float isLT0(float fValue,
String sName)
@Nonnull public static BigDecimal isLT0(@Nonnull BigDecimal aValue, String sName)
@Nonnull public static BigInteger isLT0(@Nonnull BigInteger aValue, String sName)
public static short isBetweenInclusive(short nValue,
String sName,
short nLowerBoundInclusive,
short nUpperBoundInclusive)
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusivenValue - ValuesName - NamenLowerBoundInclusive - Lower boundnUpperBoundInclusive - Upper boundpublic static int isBetweenInclusive(int nValue,
String sName,
int nLowerBoundInclusive,
int nUpperBoundInclusive)
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusivenValue - ValuesName - NamenLowerBoundInclusive - Lower boundnUpperBoundInclusive - Upper boundpublic static long isBetweenInclusive(long nValue,
String sName,
long nLowerBoundInclusive,
long nUpperBoundInclusive)
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusivenValue - ValuesName - NamenLowerBoundInclusive - Lower boundnUpperBoundInclusive - Upper boundpublic static float isBetweenInclusive(float fValue,
String sName,
float fLowerBoundInclusive,
float fUpperBoundInclusive)
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusivefValue - ValuesName - NamefLowerBoundInclusive - Lower boundfUpperBoundInclusive - Upper boundpublic static double isBetweenInclusive(double dValue,
String sName,
double dLowerBoundInclusive,
double dUpperBoundInclusive)
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusivedValue - ValuesName - NamedLowerBoundInclusive - Lower bounddUpperBoundInclusive - Upper boundpublic static BigDecimal isBetweenInclusive(@Nonnull BigDecimal aValue, String sName, @Nonnull BigDecimal aLowerBoundInclusive, @Nonnull BigDecimal aUpperBoundInclusive)
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusiveaValue - ValuesName - NameaLowerBoundInclusive - Lower boundaUpperBoundInclusive - Upper boundpublic static BigInteger isBetweenInclusive(@Nonnull BigInteger aValue, String sName, @Nonnull BigInteger aLowerBoundInclusive, @Nonnull BigInteger aUpperBoundInclusive)
nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusiveaValue - ValuesName - NameaLowerBoundInclusive - Lower boundaUpperBoundInclusive - Upper boundpublic static short isBetweenExclusive(short nValue,
String sName,
short nLowerBoundExclusive,
short nUpperBoundExclusive)
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusivenValue - ValuesName - NamenLowerBoundExclusive - Lower boundnUpperBoundExclusive - Upper boundpublic static int isBetweenExclusive(int nValue,
String sName,
int nLowerBoundExclusive,
int nUpperBoundExclusive)
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusivenValue - ValuesName - NamenLowerBoundExclusive - Lower boundnUpperBoundExclusive - Upper boundpublic static long isBetweenExclusive(long nValue,
String sName,
long nLowerBoundExclusive,
long nUpperBoundExclusive)
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusivenValue - ValuesName - NamenLowerBoundExclusive - Lower boundnUpperBoundExclusive - Upper boundpublic static float isBetweenExclusive(float fValue,
String sName,
float fLowerBoundExclusive,
float fUpperBoundExclusive)
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusivefValue - ValuesName - NamefLowerBoundExclusive - Lower boundfUpperBoundExclusive - Upper boundpublic static double isBetweenExclusive(double dValue,
String sName,
double dLowerBoundExclusive,
double dUpperBoundExclusive)
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusivedValue - ValuesName - NamedLowerBoundExclusive - Lower bounddUpperBoundExclusive - Upper boundpublic static BigDecimal isBetweenExclusive(@Nonnull BigDecimal aValue, String sName, @Nonnull BigDecimal aLowerBoundExclusive, @Nonnull BigDecimal aUpperBoundExclusive)
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusiveaValue - ValuesName - NameaLowerBoundExclusive - Lower boundaUpperBoundExclusive - Upper boundpublic static BigInteger isBetweenExclusive(@Nonnull BigInteger aValue, String sName, @Nonnull BigInteger aLowerBoundExclusive, @Nonnull BigInteger aUpperBoundExclusive)
nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusiveaValue - ValuesName - NameaLowerBoundExclusive - Lower boundaUpperBoundExclusive - Upper boundpublic static void isArrayOfsLen(@Nonnull Object[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull boolean[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull byte[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull char[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull double[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull float[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull int[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull long[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
public static void isArrayOfsLen(@Nonnull short[] aArray, @Nonnegative int nOfs, @Nonnegative int nLen)
Copyright © 2014–2016 Philip Helger. All rights reserved.