Class AbstractValueValidator<V>

    • Constructor Detail

      • AbstractValueValidator

        public AbstractValueValidator()
        The constructor.
    • Method Detail

      • validate

        public ValidationResult validate​(V value,
                                         Object valueSource)
        Description copied from interface: Validator
        This method validates the given value.
        Parameters:
        value - is the value to validate.
        valueSource - is the source describing the origin of the given value. The source needs to have a reasonable string-representation as this may be displayed to the end-user to locate the source of the failure. In most cases it is suitable to directly pass a String.
        Returns:
        the ValidationResult.
      • validateNull

        protected Localizable validateNull()
        This method performs the validation in case null was provided as value. By default null should be considered as a legal value. Only for validators such as mandatory validator this method should be overridden.
        Returns:
        the failure message or null if null is valid.
      • validateNotNull

        protected abstract Localizable validateNotNull​(V value)
        This method performs the validation in case value is NOT null. This method contains the actual custom logic for the validation. It is therefore designed in a way that makes it most simple to implement custom validators.
        Parameters:
        value - the value to validate.
        Returns:
        the failure message or null if the the given value is valid.