-
- Type Parameters:
T- the type to validate
- All Known Implementing Classes:
AbstractCompositionConstraintValidator,AbstractContainerConstraintValidator,AbstractDomainOrHostNameConstraintValidator,AssertFalseConstraintValidator,AssertTrueConstraintValidator,Base64URLEncodedConstraintValidator,CountryCodeConstraintValidator,DigitsOnlyConstraintValidator,DomainNameConstraintValidator,EmailConstraintValidator,EndsWithConstraintValidator,EnumerationCharacterConstraintValidator,EnumerationStringConstraintValidator,FutureInstantConstraintValidator,FutureOrPresentInstantConstraintValidator,HostNameConstraintValidator,IPConstraintValidator,LatConstraintValidator,LatinAlphabetOnlyConstraintValidator,LengthConstraintValidator,LngConstraintValidator,LowercaseConstraintValidator,MaxBigDecimalNumberConstraintValidator,MaxBigIntegerNumberConstraintValidator,MaxByteConstraintValidator,MaxDoubleConstraintValidator,MaxFloatConstraintValidator,MaxIntConstraintValidator,MaxLengthConstraintValidator,MaxLongConstraintValidator,MaxShortConstraintValidator,MaxSizeListConstraintValidator,MaxSizeMapConstraintValidator,MaxSizeSetConstraintValidator,MinBigDecimalNumberConstraintValidator,MinBigIntegerNumberConstraintValidator,MinByteConstraintValidator,MinDoubleConstraintValidator,MinFloatConstraintValidator,MinIntConstraintValidator,MinLengthConstraintValidator,MinLongConstraintValidator,MinShortConstraintValidator,MinSizeListConstraintValidator,MinSizeMapConstraintValidator,MinSizeSetConstraintValidator,NotEmptyStringConstraintValidator,NumericConstraintValidator,PastInstantConstraintValidator,PastOrPresentInstantConstraintValidator,PatternConstraintValidator,PhoneConstraintValidator,RequiredAndNotEmptyStringConstraintValidator,RequiredConstraintValidator,RequiredListConstraintValidator,RequiredMapConstraintValidator,RequiredSetConstraintValidator,SizeListConstraintValidator,SizeMapConstraintValidator,SizeSetConstraintValidator,SkypeConstraintValidator,StartsWithConstraintValidator,SubEnumConstraintValidator,TelegramConstraintValidator,TruncatedTimeInstantConstraintValidator,UniqueItemsListConstraintValidator,UppercaseConstraintValidator,URIConstraintValidator,URLEncodedConstraintValidator,ViberConstraintValidator,WhatsAppConstraintValidator
public interface ConstraintValidator<T>Defines the logic to validate a given constraint for a given object type.- Since:
- 0.1
- Author:
- nedis
- See Also:
DisableValidation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidvalidate(T model)Validates the root model.voidvalidate(T actual, HttpModelType httpModelType, String modelName)Validates the single actual.default voidvalidateIterable(Iterable<T> iterable)Validates all items from the iterable.default voidvalidateIterable(Iterable<T> iterable, HttpModelType httpModelType, String modelName)Validates all items from the iterable.default voidvalidateMapValues(Map<String,T> map)Validates the root model map values.default voidvalidateMapValues(Map<String,T> map, HttpModelType httpModelType, String modelName)Validates the map values.
-
-
-
Method Detail
-
validate
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
default void validate(T model)
Validates the root model.The state of the
modelmust not be altered.- Parameters:
model- the root model to validate- Throws:
io.rxmicro.http.error.ValidationException- if value does not pass the constraint
-
validateIterable
default void validateIterable(Iterable<T> iterable, HttpModelType httpModelType, String modelName)
Validates all items from the iterable.The state of the
iterablemust not be altered.If the
iterableisnullvalidator does not throwValidationException.- Parameters:
iterable- the iterable to validatehttpModelType- the http model typemodelName- the parameter or header name- Throws:
io.rxmicro.http.error.ValidationException- if value does not pass the constraint
-
validateIterable
default void validateIterable(Iterable<T> iterable)
Validates all items from the iterable.The state of the
valuemust not be altered.If the
iterableisnullvalidator does not throwValidationException.- Parameters:
iterable- the iterable to validate- Throws:
io.rxmicro.http.error.ValidationException- if value does not pass the constraint
-
validateMapValues
default void validateMapValues(Map<String,T> map, HttpModelType httpModelType, String modelName)
Validates the map values.The state of the
mapmust not be altered.- Parameters:
map- the map with values to validatehttpModelType- the http model typemodelName- the parameter or header name- Throws:
io.rxmicro.http.error.ValidationException- if value does not pass the constraint
-
-