Package feast.common.validators
Class OneOfStringValidator
- java.lang.Object
-
- feast.common.validators.OneOfStringValidator
-
- All Implemented Interfaces:
javax.validation.ConstraintValidator<OneOfStrings,String>
public class OneOfStringValidator extends Object implements javax.validation.ConstraintValidator<OneOfStrings,String>
Validates whether a string value is found within a collection.
-
-
Constructor Summary
Constructors Constructor Description OneOfStringValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(OneOfStrings constraintAnnotation)Initialize the OneOfStringValidator with a collection of allowed String values.booleanisValid(String value, javax.validation.ConstraintValidatorContext context)Validates whether a string value is found within the collection defined in the annotation.
-
-
-
Method Detail
-
initialize
public void initialize(OneOfStrings constraintAnnotation)
Initialize the OneOfStringValidator with a collection of allowed String values.- Specified by:
initializein interfacejavax.validation.ConstraintValidator<OneOfStrings,String>- Parameters:
constraintAnnotation-
-
isValid
public boolean isValid(String value, javax.validation.ConstraintValidatorContext context)
Validates whether a string value is found within the collection defined in the annotation.- Specified by:
isValidin interfacejavax.validation.ConstraintValidator<OneOfStrings,String>- Parameters:
value- String value that should be validatedcontext- Provides contextual data and operation when applying a given constraint validator- Returns:
- Boolean value indicating whether the string is found within the allowed values.
-
-