Class ValueValidator

    • Constructor Detail

      • ValueValidator

        public ValueValidator()
    • Method Detail

      • apply

        public boolean apply​(Class<?> type,
                             Object value,
                             List<ValidationFailure> validationFailures)
        Applied validation for the given field. If the value does not match the correct type, the validation is not applied and this method returns false. If the value is to be validated, then the validate method is called to see if the value and type are compatible. Errors are appended to the validationFailures list.
        Parameters:
        type - the Class of the field being queried
        value - the non-null value being used for a query
        validationFailures - the list to add any failures to. If validation passes or appliesTo returned false, this list will not change.
        Returns:
        true if validation was applied, false if this validation doesn't apply to this field type.
      • getRequiredValueType

        protected abstract Class<?> getRequiredValueType()
        Used by apply to figure out whether to apply the validation or simply return.
        Returns:
        the class the value should be in order to go ahead and perform validation