|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IRequirements
Defines common methods to check for required application state.
| Method Summary | ||
|---|---|---|
|
requireAllInstanceOf(T collParam,
Class<?> klassParam,
String... messagesParam)
Checks that all elements of the specified collection are instances of the specified class. |
|
boolean |
requireConjunction(boolean... predicatesParam)
Requires that all predicates are true. |
|
File |
requireDirectory(File fileParam,
String... messagesParam)
Checks that the specified File instance refers to a
directory. |
|
String |
requireDirectory(String filePathParam,
String... messagesParam)
Checks that the specified String instance is a path that
refers to a directory. |
|
boolean |
requireDisjunction(boolean... predicatesParam)
Checks that there is a disjunction between the specified predicates. |
|
boolean |
requireExclusiveDisjunction(boolean firstPredicateParam,
boolean secondPredicateParam)
Checks that there is a disjunction between the two specified predicates. |
|
File |
requireExistingFile(File fileParam,
String... messagesParam)
Checks that the specified File instance refers to an
existing file. |
|
String |
requireExistingFile(String filePathParam,
String... messagesParam)
Checks that the specified String instance is a path that
refers to an existing file. |
|
boolean |
requireFalse(boolean boolParam,
String... messagesParam)
Checks that the specified expression returns false. |
|
Calendar |
requireFutureInstant(Calendar calendarParam,
String... messagesParam)
|
|
Date |
requireFutureInstant(Date dateParam,
String... messagesParam)
|
|
|
requireInstanceOf(T objParam,
Class<?> klassParam,
String... messagesParam)
Checks that the specified object is an instance of the specified class. |
|
Object[] |
requireNotAllSimultaneouslyNull(Object... objectsParam)
Checks that at least one reference is not null. |
|
|
requireNotAllSimultaneouslyNull(T coll,
String... messagesParam)
Checks that at least one of the specified objects is not null. |
|
String |
requireNotBlank(String strParam,
String... messagesParam)
Checks that a string object is not blank (null or empty or only spaces). |
|
|
requireNotEmpty(T collParam,
String... messagesParam)
Checks that a collection is not empty. |
|
File |
requireNotExistingFile(File fileParam,
String... messagesParam)
Checks that the specified File instance refers to a non
existing file. |
|
String |
requireNotExistingFile(String filePathParam,
String... messagesParam)
Checks that the specified String instance is a path that
refers to a non existing file. |
|
|
requireNotNegative(T n,
String... messagesParam)
Checks that the specified number is not negative (<0). |
|
|
requireNotNegativeNorZero(T n,
String... messagesParam)
Checks that the specified number is not negative (<0) nor zero (0). |
|
|
requireNotNull(T objParam,
String... messagesParam)
Checks that an object is not null. |
|
|
requireNotPositive(T n,
String... messagesParam)
Checks that the specified number is not positive (>0). |
|
|
requireNotPositiveNorZero(T n,
String... messagesParam)
Checks that the specified number is not positive (>0) nor zero (0). |
|
|
requireNotZero(T n,
String... messagesParam)
Checks that the specified number is not zero (0). |
|
|
requireNull(T objParam,
String... messagesParam)
Checks that the specified object is null. |
|
Calendar |
requirePastInstant(Calendar dateParam,
String... messagesParam)
|
|
Date |
requirePastInstant(Date dateParam,
String... messagesParam)
|
|
boolean |
requireTrue(boolean boolParam,
String... messagesParam)
Checks that the specified expression returns true. |
|
| Method Detail |
|---|
<T extends Collection<?>> T requireAllInstanceOf(T collParam,
Class<?> klassParam,
String... messagesParam)
collParam - The specified collection.klassParam - The class which all specified collection's elements should be
instances of.messagesParam - Additional messages with more detail.boolean requireConjunction(boolean... predicatesParam)
true. At least one
predicate must be specified.
predicatesParam - The specified predicates.
true if all predicates are true.
File requireDirectory(File fileParam,
String... messagesParam)
File instance refers to a
directory.
fileParam - The specified file. Must not be null.messagesParam - Additional messages with more detail.
String requireDirectory(String filePathParam,
String... messagesParam)
String instance is a path that
refers to a directory.
filePathParam - The specified file path. Must not be blank.messagesParam - Additional messages with more detail.
boolean requireDisjunction(boolean... predicatesParam)
true. Remember that the values of the
predicates are calculated eagerly, before the execution of the method.
predicatesParam - The specified predicates.
true if at least one predicate is
true.
boolean requireExclusiveDisjunction(boolean firstPredicateParam,
boolean secondPredicateParam)
firstPredicateParam - The first predicate.secondPredicateParam - The second predicate.
true if exactly one predicate is
true.
File requireExistingFile(File fileParam,
String... messagesParam)
File instance refers to an
existing file.
fileParam - The specified file. Must not be null.messagesParam - Additional messages with more detail.
String requireExistingFile(String filePathParam,
String... messagesParam)
String instance is a path that
refers to an existing file.
filePathParam - The specified file path. Must not be blank.messagesParam - Additional messages with more detail.
boolean requireFalse(boolean boolParam,
String... messagesParam)
boolParam - The expression.messagesParam - additional messages with more detail.
Calendar requireFutureInstant(Calendar calendarParam,
String... messagesParam)
Date requireFutureInstant(Date dateParam,
String... messagesParam)
<T> T requireInstanceOf(T objParam,
Class<?> klassParam,
String... messagesParam)
objParam - The specified object.klassParam - The class which the specified object should be an instance of.messagesParam - additional messages with more detail.Object[] requireNotAllSimultaneouslyNull(Object... objectsParam)
objectsParam - The references to objects that may be null.
<T extends Collection<?>> T requireNotAllSimultaneouslyNull(T coll,
String... messagesParam)
null.
T - The type of the collection of specified objects.coll - The collection of specified objects.messagesParam - additional messages with more detail.
String requireNotBlank(String strParam,
String... messagesParam)
strParam - The string.messagesParam - additional messages with more detail.
<T extends Collection<?>> T requireNotEmpty(T collParam,
String... messagesParam)
collParam - The collection to check for emptyness.messagesParam - additional messages with more detail.
File requireNotExistingFile(File fileParam,
String... messagesParam)
File instance refers to a non
existing file.
fileParam - The specified file. Must not be null.messagesParam - Additional messages with more detail.
String requireNotExistingFile(String filePathParam,
String... messagesParam)
String instance is a path that
refers to a non existing file.
filePathParam - The specified file path. Must not be blank.messagesParam - Additional messages with more detail.
<T extends Number> T requireNotNegative(T n,
String... messagesParam)
n - The specified number.messagesParam - additional messages with more detail.
<T extends Number> T requireNotNegativeNorZero(T n,
String... messagesParam)
n - The specified number.messagesParam - additional messages with more detail.
<T> T requireNotNull(T objParam,
String... messagesParam)
public Foo(Bar bar) {
this.bar = Objects.requireNotNull(bar);
}
T - type of the object.objParam - The object.messagesParam - additional messages with more detail.
<T extends Number> T requireNotPositive(T n,
String... messagesParam)
messagesParam - additional messages with more detail.n - The specified number.
<T extends Number> T requireNotPositiveNorZero(T n,
String... messagesParam)
messagesParam - additional messages with more detail.n - The specified number.
<T extends Number> T requireNotZero(T n,
String... messagesParam)
messagesParam - additional messages with more detail.n - The specified number.
<T> T requireNull(T objParam,
String... messagesParam)
null.
T - The object's type.objParam - The specified object.messagesParam - additional messages with more detail.
Calendar requirePastInstant(Calendar dateParam,
String... messagesParam)
Date requirePastInstant(Date dateParam,
String... messagesParam)
boolean requireTrue(boolean boolParam,
String... messagesParam)
messagesParam - additional messages with more detail.boolParam - The expression.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||