Class UniqueElementsValidator

    • Constructor Detail

      • UniqueElementsValidator

        public UniqueElementsValidator()
    • Method Detail

      • isValid

        public boolean isValid​(Collection collection,
                               ConstraintValidatorContext constraintValidatorContext)
        Description copied from interface: ConstraintValidator
        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.

        Specified by:
        isValid in interface ConstraintValidator<UniqueElements,​Collection>
        Parameters:
        collection - the collection to validate
        constraintValidatorContext - context in which the constraint is evaluated
        Returns:
        true if the input collection is null or does not contain duplicate elements