Package org.apache.wicket.util.lang
Class Args
java.lang.Object
org.apache.wicket.util.lang.Args
Class with methods for asserting conditions on arguments.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Check if argument is falsestatic boolean
Check if argument is truestatic String
Checks argument is not empty (not null and has a non-whitespace character) Note: This method overloadsnotEmpty(CharSequence, String)
for performance reasons.static <T extends CharSequence>
TChecks argument is not empty (not null and has a non-whitespace character)static <T extends Collection<?>>
TChecks argument is not null or emptystatic <T> T
Checks argument is not nullstatic <T extends Comparable<? super T>>
TwithinRange
(T min, T max, T value, String name) Checks if argument is within a range
-
Constructor Details
-
Args
public Args()
-
-
Method Details
-
notNull
Checks argument is not null- Type Parameters:
T
-- Parameters:
argument
-name
-- Returns:
- The 'argument' parameter
- Throws:
IllegalArgumentException
-
notEmpty
Checks argument is not empty (not null and has a non-whitespace character)- Type Parameters:
T
- the type of the argument to check for emptiness- Parameters:
argument
- the argument to check for emptinessname
- the name to use in the error message- Returns:
- The
argument
parameter if not empty - Throws:
IllegalArgumentException
- when the passedargument
is empty
-
notEmpty
Checks argument is not empty (not null and has a non-whitespace character) Note: This method overloadsnotEmpty(CharSequence, String)
for performance reasons.- Parameters:
argument
- the argument to check for emptinessname
- the name to use in the error message- Returns:
- The
argument
parameter if not empty - Throws:
IllegalArgumentException
- when the passedargument
is empty
-
notEmpty
Checks argument is not null or empty- Parameters:
collection
-message
-params
-- Returns:
- the {code collection}
- Throws:
IllegalArgumentException
- if the passed collection is either null or empty
-
notEmpty
Checks argument is not null or empty- Parameters:
collection
-name
-- Returns:
- the {code collection}
- Throws:
IllegalArgumentException
- if the passed collection is either null or empty
-
withinRange
Checks if argument is within a range- Type Parameters:
T
-- Parameters:
min
-max
-value
-name
-- Returns:
- the {code value}
- Throws:
IllegalArgumentException
-
isTrue
Check if argument is true- Parameters:
argument
-msg
-params
-- Returns:
- argument
-
isFalse
Check if argument is false- Parameters:
argument
-msg
-params
-- Returns:
- argument
-