Package org.gcube.idm.client.utils
Class Validate
- java.lang.Object
-
- org.gcube.idm.client.utils.Validate
-
public class Validate extends Object
-
-
Constructor Summary
Constructors Constructor Description Validate()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidisTrue(boolean expression, String message)Validate that the argument condition istrue; otherwise throwing an exception with the specified message.
-
-
-
Method Detail
-
isTrue
public static void isTrue(boolean expression, String message)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), "The value must be greater than zero"); Validate.isTrue( myObject.isOk(), "The object is not OK");
- Parameters:
expression- the boolean expression to checkmessage- the exception message if invalid- Throws:
IllegalArgumentException- if expression isfalse
-
-