Module rxmicro.validation
Package io.rxmicro.validation.base
Class AbstractMinConstraintValidator<T extends Comparable<T>>
- java.lang.Object
-
- io.rxmicro.validation.base.AbstractMinConstraintValidator<T>
-
- Type Parameters:
T- the type to validate
- Direct Known Subclasses:
MinBigDecimalNumberConstraintValidator,MinBigIntegerNumberConstraintValidator,MinByteConstraintValidator,MinDoubleConstraintValidator,MinFloatConstraintValidator,MinIntConstraintValidator,MinLengthConstraintValidator,MinLongConstraintValidator,MinShortConstraintValidator,MinSizeConstraintValidator
public abstract class AbstractMinConstraintValidator<T extends Comparable<T>> extends Object
Base validator class for minimum constraints.- Since:
- 0.1
- Author:
- nedis
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMinConstraintValidator(T minValue, boolean inclusive)Creates an instance of the base validator class for minimum constraint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvalidate(T actual, HttpModelType httpModelType, String modelName)Validates the single actual.protected voidvalidate(T actual, HttpModelType httpModelType, String modelName, String inclusiveErrorMessageTemplate, String exclusiveErrorMessageTemplate)Validates the single actual.
-
-
-
Constructor Detail
-
AbstractMinConstraintValidator
protected AbstractMinConstraintValidator(T minValue, boolean inclusive)
Creates an instance of the base validator class for minimum constraint.- Parameters:
minValue- the minimum supported valueinclusive- specifies whether the specified minimum is inclusive or not.
-
-
Method Detail
-
validate
public final void validate(T actual, HttpModelType httpModelType, String modelName)
Validates the single actual.The state of the
actualmust not be altered.- Parameters:
actual- the actual value to validatehttpModelType- the http model typemodelName- the parameter or header name- Throws:
io.rxmicro.http.error.ValidationException- if actual does not pass the constraint
-
validate
protected final void validate(T actual, HttpModelType httpModelType, String modelName, String inclusiveErrorMessageTemplate, String exclusiveErrorMessageTemplate)
Validates the single actual.The state of the
actualmust not be altered.- Parameters:
actual- the actual value to validatehttpModelType- the http model typemodelName- the parameter or header nameinclusiveErrorMessageTemplate- the inclusive error message templateexclusiveErrorMessageTemplate- the exclusive error message template- Throws:
io.rxmicro.http.error.ValidationException- if actual does not pass the constraint
-
-