Package org.apache.wicket.util.lang
Class Args
- java.lang.Object
-
- org.apache.wicket.util.lang.Args
-
-
Constructor Summary
Constructors Constructor Description Args()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isFalse(boolean argument, String msg, Object... params)
Check if argument is falsestatic boolean
isTrue(boolean argument, String msg, Object... params)
Check if argument is truestatic String
notEmpty(String argument, String name)
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>
TnotEmpty(T argument, String name)
Checks argument is not empty (not null and has a non-whitespace character)static <T extends Collection<?>>
TnotEmpty(T collection, String message, Object... params)
Checks argument is not null or emptystatic <T> T
notNull(T argument, String name)
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 Detail
-
Args
public Args()
-
-
Method Detail
-
notNull
public static <T> T notNull(T argument, String name)
Checks argument is not null- Type Parameters:
T
-- Parameters:
argument
-name
-- Returns:
- The 'argument' parameter
- Throws:
IllegalArgumentException
-
notEmpty
public static <T extends CharSequence> T notEmpty(T argument, String name)
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
public static String notEmpty(String argument, String name)
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
public static <T extends Collection<?>> T notEmpty(T collection, String message, Object... params)
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
public static <T extends Collection<?>> T notEmpty(T collection, String name)
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
public static <T extends Comparable<? super T>> T withinRange(T min, T max, T value, String name)
Checks if argument is within a range- Type Parameters:
T
-- Parameters:
min
-max
-value
-name
-- Returns:
- the {code value}
- Throws:
IllegalArgumentException
-
isTrue
public static boolean isTrue(boolean argument, String msg, Object... params)
Check if argument is true- Parameters:
argument
-msg
-params
-- Returns:
- argument
-
-