Class URIValidator

  • All Implemented Interfaces:
    javax.validation.ConstraintValidator<HttpURI,​URI>

    public class URIValidator
    extends Object
    implements javax.validation.ConstraintValidator<HttpURI,​URI>
    Constrain validator that validates URI objects with a @HttpURI annotation.
    • Method Detail

      • initialize

        public void initialize​(HttpURI uri)
        Initializes the validator in preparation for isValid(URI, javax.validation.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.
        Specified by:
        initialize in interface javax.validation.ConstraintValidator<HttpURI,​URI>
        Parameters:
        uri - annotation instance for a given constraint declaration
      • isValid

        public boolean isValid​(URI uri,
                               javax.validation.ConstraintValidatorContext context)
        Implements the validation logic, checking if a URI is valid or not. 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 javax.validation.ConstraintValidator<HttpURI,​URI>
        Parameters:
        uri - object to validate
        context - context in which the constraint is evaluated
        Returns:
        false if value does not pass the constraint