Package org.codehaus.mojo.jaxb2.shared
Class Validate
- java.lang.Object
-
- org.codehaus.mojo.jaxb2.shared.Validate
-
public final class Validate extends java.lang.Object
Simple argument validator, inspired by the commons-lang.- Since:
- 2.0
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Validate()
Hide constructor for utility classes.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
getMessage(java.lang.String exceptionDefinition, java.lang.String argumentName)
static void
isTrue(boolean condition, java.lang.String message)
Validates that the supplied condition is true, and throws an IllegalArgumentException otherwise.static void
notEmpty(java.lang.String aString, java.lang.String argumentName)
Validates that the supplied object is not null, and throws an IllegalArgumentException otherwise.static void
notNull(java.lang.Object object, java.lang.String argumentName)
Validates that the supplied object is not null, and throws a NullPointerException otherwise.
-
-
-
Method Detail
-
notNull
public static void notNull(java.lang.Object object, java.lang.String argumentName)
Validates that the supplied object is not null, and throws a NullPointerException otherwise.- Parameters:
object
- The object to validate fornull
-ness.argumentName
- The argument name of the object to validate. If supplied (i.e. non-null
), this value is used in composing a better exception message.
-
notEmpty
public static void notEmpty(java.lang.String aString, java.lang.String argumentName)
Validates that the supplied object is not null, and throws an IllegalArgumentException otherwise.- Parameters:
aString
- The string to validate for emptyness.argumentName
- The argument name of the object to validate. If supplied (i.e. non-null
), this value is used in composing a better exception message.
-
isTrue
public static void isTrue(boolean condition, java.lang.String message)
Validates that the supplied condition is true, and throws an IllegalArgumentException otherwise.- Parameters:
condition
- The condition to validate for truth.message
- The exception message used within the IllegalArgumentException if the condition is false.
-
getMessage
private static java.lang.String getMessage(java.lang.String exceptionDefinition, java.lang.String argumentName)
-
-