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
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.
-
-
-
Field Detail
-
maxValue
protected final T extends Comparable<T> maxValue
The maximum supported value.
-
inclusive
protected final boolean inclusive
Specifies whether the specified maximum is inclusive or not.
-
-
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 maximum 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
-
-