Package net.officefloor.gef.configurer
Interface ValueValidator<M,V>
-
public interface ValueValidator<M,V>
Validates the value.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ValueValidator.ValueValidatorContext<M,V>
Context for theValueValidator
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <M> ValueValidator<M,java.lang.String>
notEmptyString(java.lang.String errorMessage)
ConvenienceValueValidator
for ensuring not an emptyString
.static void
notEmptyString(java.lang.String value, java.lang.String errorMessage, ValueValidator.ValueValidatorContext<?,?> context)
Convenience method to provide error if value is empty string.static void
notNull(java.lang.Object value, java.lang.String errorMessage, ValueValidator.ValueValidatorContext<?,?> context)
Convenience method to provide error if value isnull
.static <M,V>
ValueValidator<M,V>notNull(java.lang.String errorMessage)
ConvenienceValueValidator
for ensuring notnull
.void
validate(ValueValidator.ValueValidatorContext<? extends M,V> context)
Undertakes the validation.
-
-
-
Method Detail
-
notNull
static <M,V> ValueValidator<M,V> notNull(java.lang.String errorMessage)
ConvenienceValueValidator
for ensuring notnull
.- Type Parameters:
M
- Model type.V
- Value type.- Parameters:
errorMessage
- Error message ifnull
.- Returns:
ValueValidator
to validate notnull
.
-
notNull
static void notNull(java.lang.Object value, java.lang.String errorMessage, ValueValidator.ValueValidatorContext<?,?> context)
Convenience method to provide error if value isnull
.- Parameters:
value
- Value to check fornull
.errorMessage
- Error message if empty string.context
-ValueValidator.ValueValidatorContext
.
-
notEmptyString
static <M> ValueValidator<M,java.lang.String> notEmptyString(java.lang.String errorMessage)
ConvenienceValueValidator
for ensuring not an emptyString
.- Type Parameters:
M
- Model type.- Parameters:
errorMessage
- Error message if emptyString
.- Returns:
ValueValidator
to validate not an emptyString
.
-
notEmptyString
static void notEmptyString(java.lang.String value, java.lang.String errorMessage, ValueValidator.ValueValidatorContext<?,?> context)
Convenience method to provide error if value is empty string.- Parameters:
value
- Value to check for empty string.errorMessage
- Error message if empty string.context
-ValueValidator.ValueValidatorContext
.
-
validate
void validate(ValueValidator.ValueValidatorContext<? extends M,V> context) throws java.lang.Exception
Undertakes the validation.- Parameters:
context
-ValueValidator.ValueValidatorContext
.- Throws:
java.lang.Exception
- If failure in validation. Message ofException
is used as error.
-
-