public final class Validate extends Object
public static void isTrue(boolean expression, String message, Object... messageArguments)
Validate that the argument condition is true
; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary boolean expression, such as validating a
primitive number or using your own custom validation expression.
Validate.isTrue(i > 0.0, "The value must be greater than zero: %d", i);
For performance reasons, the long value is passed as a separate parameter and appended to the exception message only in the case of an error.
expression
- the boolean expression to checkmessage
- the String.format(String, Object...)
exception message if invalid, not nullmessageArguments
- the arguments for formatting the message when invalidIllegalArgumentException
- if expression is false
Copyright © 2015 JBoss by Red Hat. All Rights Reserved.