Module rxmicro.validation
Package io.rxmicro.validation.base
Class AbstractMaxConstraintValidator<T extends Comparable<T>>
- java.lang.Object
-
- io.rxmicro.validation.base.AbstractMaxConstraintValidator<T>
-
- Type Parameters:
T- the type to validate
- Direct Known Subclasses:
MaxBigDecimalNumberConstraintValidator,MaxBigIntegerNumberConstraintValidator,MaxByteConstraintValidator,MaxDoubleConstraintValidator,MaxFloatConstraintValidator,MaxIntConstraintValidator,MaxLengthConstraintValidator,MaxLongConstraintValidator,MaxShortConstraintValidator,MaxSizeConstraintValidator
public abstract class AbstractMaxConstraintValidator<T extends Comparable<T>> extends Object
Base validator class for maximum constraints.- Since:
- 0.1
- Author:
- nedis
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMaxConstraintValidator(T maxValue, boolean inclusive)Creates an instance of the base validator class for maximum 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
-
AbstractMaxConstraintValidator
protected AbstractMaxConstraintValidator(T maxValue, boolean inclusive)
Creates an instance of the base validator class for maximum constraint.- Parameters:
maxValue- the maximum supported valueinclusive- specifies whether the specified min 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
-
-