- Type Parameters:
T- The type of value to be validated
- All Known Implementing Classes:
AbstractConstraintAdapter,AbstractContainerAdapter
public interface ValidationAdapter<T>
This interface defines a set of validation methods for validating a value based on specific
rules. The methods in this interface allow for executing validations, composing validation
adapters, and checking validation groups.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ValidationAdapter<T>andThen(ValidationAdapter<? super T> after) Compose this validation adapter with another adapter by applying the validations in sequence.default AbstractContainerAdapter<T>array()Create an adapter for validating an array.default booleancheckGroups(Set<Class<?>> adapterGroups, ValidationRequest request) Check if the validation request groups are empty or match any of the adapter's configured groups.default AbstractContainerAdapter<T>list()Create an adapter for validating a list of values.default AbstractContainerAdapter<T>mapKeys()Create an adapter for validating map keys.default AbstractContainerAdapter<T>Create an adapter for validating map values.default AbstractContainerAdapter<T>optional()Create an adapter for validating an optional value.default booleanvalidate(T value, ValidationRequest req) Execute validations for the given valuebooleanvalidate(T value, ValidationRequest req, String propertyName) Execute validations for the given value.
-
Method Details
-
validate
Execute validations for the given value.- Parameters:
value- The value to be validatedreq- The validation request containing group/locale/violation informationpropertyName- The name of the property being validated- Returns:
trueif validation should continue,falseotherwise
-
validate
Execute validations for the given value- Parameters:
value- The value to be validatedreq- The validation request containing group/locale/violation information- Returns:
trueif validation should continue,falseotherwise
-
list
Create an adapter for validating a list of values.- Returns:
- The adapter for list validation
-
mapKeys
Create an adapter for validating map keys.- Returns:
- The adapter for map key validation
-
mapValues
Create an adapter for validating map values.- Returns:
- The adapter for map value validation
-
array
Create an adapter for validating an array.- Returns:
- The adapter for array validation
-
optional
Create an adapter for validating an optional value.- Returns:
- The adapter for optional value validation
-
andThen
Compose this validation adapter with another adapter by applying the validations in sequence.- Parameters:
after- The validation adapter to be applied after this adapter- Returns:
- The composed validation adapter
- Throws:
NullPointerException- ifafteris null
-
checkGroups
Check if the validation request groups are empty or match any of the adapter's configured groups.- Parameters:
adapterGroups- The groups configured for this adapterrequest- The validation request containing the groups to be checked- Returns:
trueif the groups match or if the validation request groups are empty,falseotherwise
-