Package com.hotels.beans.utils
Class ValidationUtils
- java.lang.Object
-
- com.hotels.beans.utils.ValidationUtils
-
public class ValidationUtils extends java.lang.Object
Validation utils for Class objects.
-
-
Constructor Summary
Constructors Constructor Description ValidationUtils()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> void
notNull(T object)
Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
with the specified message.static <T> void
notNull(T object, java.lang.String message)
Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
with the specified message.<K> void
validate(K k)
Checks if an object is valid.
-
-
-
Method Detail
-
notNull
public static <T> void notNull(T object)
Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
with the specified message.- Type Parameters:
T
- the object type- Parameters:
object
- the object to check- Throws:
java.lang.IllegalArgumentException
- if the object isnull
-
notNull
public static <T> void notNull(T object, java.lang.String message)
Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
with the specified message.- Type Parameters:
T
- the object type- Parameters:
object
- the object to checkmessage
- theString.format(String, Object...)
exception message if invalid, not null- Throws:
java.lang.IllegalArgumentException
- if the object isnull
-
validate
public final <K> void validate(K k)
Checks if an object is valid.- Type Parameters:
K
- the object class- Parameters:
k
- the object to check- Throws:
InvalidBeanException
-InvalidBeanException
if the validation fails
-
-