Class AbstractValidator<T>

    • Constructor Detail

      • AbstractValidator

        public AbstractValidator​(String errorMessage)
        Deprecated.
        Constructs a validator with the given error message.
        Parameters:
        errorMessage - the message to be included in an Validator.InvalidValueException (with "{0}" replaced by the value that failed validation).
    • Method Detail

      • isValidValue

        protected abstract boolean isValidValue​(T value)
        Deprecated.
        Internally check the validity of a value. This method can be used to perform validation in subclasses if customization of the error message is not needed. Otherwise, subclasses should override validate(Object) and the return value of this method is ignored. This method should not be called from outside the validator class itself.
        Parameters:
        value -
        Returns:
      • isValidType

        protected boolean isValidType​(Object value)
        Deprecated.
        Checks the type of the value to validate to ensure it conforms with getType. Enables sub classes to handle the specific type instead of Object.
        Parameters:
        value - The value to check
        Returns:
        true if the value can safely be cast to the type specified by getType()
      • getErrorMessage

        public String getErrorMessage()
        Deprecated.
        Returns the message to be included in the exception in case the value does not validate.
        Returns:
        the error message provided in the constructor or using setErrorMessage(String).
      • setErrorMessage

        public void setErrorMessage​(String errorMessage)
        Deprecated.
        Sets the message to be included in the exception in case the value does not validate. The exception message is typically shown to the end user.
        Parameters:
        errorMessage - the error message. "{0}" is automatically replaced by the value that did not validate.
      • getType

        public abstract Class<T> getType()
        Deprecated.