|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.shibboleth.utilities.java.support.logic.Constraint
public final class Constraint
A helper class for evaluating certain constraints. Any violation will thrown a ConstraintViolationException.
| Constructor Summary | |
|---|---|
private |
Constraint()
Constructor. |
| Method Summary | ||
|---|---|---|
static
|
isEmpty(Collection<T> collection,
String message)
Checks that the given collection is empty. |
|
static boolean |
isFalse(boolean b,
String message)
Checks that the given boolean is false. |
|
static long |
isGreaterThan(long threshold,
long number,
String message)
Checks that the given number is greater than a given threshold. |
|
static long |
isGreaterThanOrEqual(long threshold,
long number,
String message)
Checks that the given number is greater than, or equal to, a given threshold. |
|
static long |
isLessThan(long threshold,
long number,
String message)
Checks that the given number is less than a given threshold. |
|
static long |
isLessThanOrEqual(long threshold,
long number,
String message)
Checks that the given number is less than, or equal to, a given threshold. |
|
static
|
isNotEmpty(Collection<T> collection,
String message)
Checks that the given collection is not empty. |
|
static
|
isNotNull(T obj,
String message)
Checks that the given object is not null. |
|
static
|
isNull(T obj,
String message)
Checks that the given object is null. |
|
static boolean |
isTrue(boolean b,
String message)
Checks that the given boolean is true. |
|
static
|
noNullItems(T[] array,
String message)
Checks that the array does not contain any null elements. |
|
static long |
numberInRangeExclusive(long lowerTheshold,
long upperThreshold,
long number,
String message)
Checks that the given number is in the exclusive range. |
|
static long |
numberInRangeInclusive(long lowerTheshold,
long upperThreshold,
long number,
String message)
Checks that the given number is in the inclusive range. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private Constraint()
| Method Detail |
|---|
@Nonnull
public static <T> Collection<T> isEmpty(@Nonnull
Collection<T> collection,
@Nonnull
String message)
ConstraintViolationException
is thrown.
T - type of items in the collectioncollection - collection checkmessage - message used in the ConstraintViolationException
public static boolean isFalse(boolean b,
@Nonnull
String message)
ConstraintViolationException is thrown.
b - boolean to checkmessage - message used in ConstraintViolationException
public static long isGreaterThan(long threshold,
long number,
@Nonnull
String message)
ConstraintViolationException is thrown.
threshold - the thresholdnumber - the number to be checkedmessage - message used in the ConstraintViolationException
public static long isGreaterThanOrEqual(long threshold,
long number,
@Nonnull
String message)
ConstraintViolationException is thrown.
threshold - the thresholdnumber - the number to be checkedmessage - message used in the ConstraintViolationException
public static long isLessThan(long threshold,
long number,
@Nonnull
String message)
ConstraintViolationException is thrown.
threshold - the thresholdnumber - the number to be checkedmessage - message used in the ConstraintViolationException
public static long isLessThanOrEqual(long threshold,
long number,
@Nonnull
String message)
ConstraintViolationException is thrown.
threshold - the thresholdnumber - the number to be checkedmessage - message used in the ConstraintViolationException
@Nonnull
public static <T> Collection<T> isNotEmpty(@Nonnull
Collection<T> collection,
@Nonnull
String message)
ConstraintViolationException
is thrown.
T - type of items in the collectioncollection - collection checkmessage - message used in the ConstraintViolationException
@Nonnull
public static <T> T isNotNull(@Nullable
T obj,
@Nonnull
String message)
ConstraintViolationException is
thrown.
T - object typeobj - object to checkmessage - message used in ConstraintViolationException
@Nullable
public static <T> T isNull(@Nullable
T obj,
@Nonnull
String message)
ConstraintViolationException is
thrown.
T - object typeobj - object to checkmessage - message used in ConstraintViolationException
public static boolean isTrue(boolean b,
@Nonnull
String message)
ConstraintViolationException is thrown.
b - boolean to checkmessage - message used in ConstraintViolationException
@Nonnull
public static <T> T[] noNullItems(@Nonnull
T[] array,
@Nonnull
String message)
T - type of elements in the arrayarray - array to checkmessage - message used in the ConstraintViolationException
public static long numberInRangeExclusive(long lowerTheshold,
long upperThreshold,
long number,
@Nonnull
String message)
ConstraintViolationException is thrown.
lowerTheshold - lower bound of the rangeupperThreshold - upper bound of the rangenumber - number to checkmessage - message used in the ConstraintViolationException
public static long numberInRangeInclusive(long lowerTheshold,
long upperThreshold,
long number,
@Nonnull
String message)
ConstraintViolationException is thrown.
lowerTheshold - lower bound of the rangeupperThreshold - upper bound of the rangenumber - number to checkmessage - message used in the ConstraintViolationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||