Package org.codehaus.mojo.jaxb2.shared
Class Validate
java.lang.Object
org.codehaus.mojo.jaxb2.shared.Validate
Simple argument validator, inspired by the commons-lang.
- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
getMessage
(String exceptionDefinition, String argumentName) static void
Validates that the supplied condition is true, and throws an IllegalArgumentException otherwise.static void
Validates that the supplied object is not null, and throws an IllegalArgumentException otherwise.static void
Validates that the supplied object is not null, and throws a NullPointerException otherwise.
-
Constructor Details
-
Validate
private Validate()Hide constructor for utility classes.
-
-
Method Details
-
notNull
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
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
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
-