Class ValueValidator

    • Constructor Summary

      Constructors 
      Constructor Description
      ValueValidator()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean apply​(java.lang.Class<?> type, java.lang.Object value, java.util.List<ValidationFailure> validationFailures)
      Applied validation for the given field.
      protected abstract java.lang.Class<?> getRequiredValueType()
      Used by apply to figure out whether to apply the validation or simply return.
      protected abstract void validate​(java.lang.Class<?> type, java.lang.Object value, java.util.List<ValidationFailure> validationFailures)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ValueValidator

        public ValueValidator()
    • Method Detail

      • apply

        public boolean apply​(java.lang.Class<?> type,
                             java.lang.Object value,
                             java.util.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 java.lang.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
      • validate

        protected abstract void validate​(java.lang.Class<?> type,
                                         java.lang.Object value,
                                         java.util.List<ValidationFailure> validationFailures)