Top Description Fields Constructors Methods
org.hibernate.validator.internal.constraintvalidators.hv.time

public Class DurationMinValidator

extends Object
implements ConstraintValidator<DurationMin, Duration>
Class Inheritance
All Implemented Interfaces
jakarta.validation.ConstraintValidator
Imports
java.time.Duration, jakarta.validation.ConstraintValidator, .ConstraintValidatorContext, org.hibernate.validator.constraints.time.DurationMin

Checks that a validated Duration length is longer than or equal to the one specified with the annotation.
Author
Marko Bekhta

Field Summary

Modifier and TypeField and Description
private boolean
private Duration

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
initialize(DurationMin
annotation instance for a given constraint declaration
constraintAnnotation
)

Overrides default jakarta.validation.ConstraintValidator.initialize.

Initializes the validator in preparation for isValid(Object, ConstraintValidatorContext) calls.
public boolean
isValid(Duration
object to validate
value
,
ConstraintValidatorContext
context in which the constraint is evaluated
context
)

Implements jakarta.validation.ConstraintValidator.isValid.

Implements the validation logic.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inclusiveback to summary
private boolean inclusive
minDurationback to summary
private Duration minDuration

Constructor Detail

DurationMinValidatorback to summary
public DurationMinValidator()

Method Detail

initializeback to summary
public void initialize(DurationMin constraintAnnotation)

Overrides default jakarta.validation.ConstraintValidator.initialize.

Doc from jakarta.validation.ConstraintValidator.initialize.

Initializes the validator in preparation for isValid(Object, ConstraintValidatorContext) calls. The constraint annotation for a given constraint declaration is passed.

This method is guaranteed to be called before any use of this instance for validation.

The default implementation is a no-op.

Parameters
constraintAnnotation:DurationMin

annotation instance for a given constraint declaration

Annotations
@Override
isValidback to summary
public boolean isValid(Duration value, ConstraintValidatorContext context)

Implements jakarta.validation.ConstraintValidator.isValid.

Doc from jakarta.validation.ConstraintValidator.isValid.

Implements the validation logic. The state of value must not be altered.

This method can be accessed concurrently, thread-safety must be ensured by the implementation.

Parameters
value:Duration

object to validate

context:ConstraintValidatorContext

context in which the constraint is evaluated

Returns:boolean

false if value does not pass the constraint

Annotations
@Override