Class ValidLanguageValidator
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.module.web.validation.validators.ValidLanguageValidator
-
- All Implemented Interfaces:
javax.validation.ConstraintValidator<ValidLanguage,java.lang.String>
public class ValidLanguageValidator extends java.lang.Object implements javax.validation.ConstraintValidator<ValidLanguage,java.lang.String>
Form validator that checks if the language supplied is valid (i.e. in the registry of supported languages)
-
-
Constructor Summary
Constructors Constructor Description ValidLanguageValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
initialize(ValidLanguage constraint)
boolean
isValid(java.lang.String language, javax.validation.ConstraintValidatorContext context)
Performs the validation step by checking that the language is set and then that it is in the list of languages in the Sherlock Registry
-
-
-
Method Detail
-
initialize
public void initialize(ValidLanguage constraint)
- Specified by:
initialize
in interfacejavax.validation.ConstraintValidator<ValidLanguage,java.lang.String>
-
isValid
public boolean isValid(java.lang.String language, javax.validation.ConstraintValidatorContext context)
Performs the validation step by checking that the language is set and then that it is in the list of languages in the Sherlock Registry- Specified by:
isValid
in interfacejavax.validation.ConstraintValidator<ValidLanguage,java.lang.String>
- Parameters:
language
- the language to checkcontext
- (not used here)- Returns:
- whether or not the validation passed
-
-