Add new OneOfValidator for CharSequence validation

Description

I would like to contribute a new OneOfValidator for the Hibernate Validator project.

This validator checks if a given CharSequence matches one of the allowed values specified in the OneOf annotation.

Features:

  • Validates if a CharSequence is one of the allowed values.

  • Supports case-sensitive and case-insensitive validation based on the ignoreCase flag in the OneOf annotation.

  • Supports both Enum constants and manually provided allowed values.

The validator has been implemented as follows:

  • OneOfValidator class implements ConstraintValidator<OneOf, CharSequence>.

  • Adds values from allowedValues() and enumClass() in the OneOf annotation for validation.

  • Provides methods to handle case-sensitive and case-insensitive validation.

Environment

None

Activity

Details

Assignee

Reporter

Labels

Participants

Yusuf Alamu

Priority

Created December 19, 2024 at 8:19 PM
Updated December 30, 2024 at 4:01 PM

Flag notifications