Interface SizeValidator<T>
- Type Parameters:
T
- The type to constrain
- All Superinterfaces:
ConstraintValidator<jakarta.validation.constraints.Size,
,T> jakarta.validation.ConstraintValidator<jakarta.validation.constraints.Size,
T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface SizeValidator<T>
extends ConstraintValidator<jakarta.validation.constraints.Size,T>
Abstract implementation of a
Size
validator.- Since:
- 1.2
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.validation.validator.constraints.ConstraintValidator
VALID
-
Method Summary
Modifier and TypeMethodDescriptionint
Evaluate the size for the given value.default boolean
isValid
(T value, @NonNull io.micronaut.core.annotation.AnnotationValue<jakarta.validation.constraints.Size> annotationMetadata, @NonNull ConstraintValidatorContext context) Implements the validation logic.Methods inherited from interface io.micronaut.validation.validator.constraints.ConstraintValidator
isValid
Methods inherited from interface jakarta.validation.ConstraintValidator
initialize
-
Method Details
-
isValid
default boolean isValid(@Nullable T value, @NonNull @NonNull io.micronaut.core.annotation.AnnotationValue<jakarta.validation.constraints.Size> annotationMetadata, @NonNull @NonNull ConstraintValidatorContext context) Description copied from interface:ConstraintValidator
Implements the validation logic.Implementations should be thread-safe and immutable.
- Specified by:
isValid
in interfaceConstraintValidator<jakarta.validation.constraints.Size,
T> - Parameters:
value
- object to validateannotationMetadata
- The annotation metadatacontext
- The context object- Returns:
false
ifvalue
does not pass the constraint
-
getSize
Evaluate the size for the given value.- Parameters:
value
- The value- Returns:
- The size
-