Class DefaultValidatableService

  • All Implemented Interfaces:
    ValidatableService

    public class DefaultValidatableService
    extends java.lang.Object
    implements ValidatableService
    Default Implementation of the ValidatableService. This implementation executes the validatable supplier and then checks if there are errors registered. If there are errors present in current ValidationErrors, then it throws a validation exception with the list of Errors.
    • Constructor Detail

      • DefaultValidatableService

        public DefaultValidatableService()
    • Method Detail

      • execute

        public <T> T execute​(java.util.function.Supplier<T> validatable)
        Description copied from interface: ValidatableService
        Executes the validatable supplier to collect any validation error after execution
        Specified by:
        execute in interface ValidatableService
        Parameters:
        validatable - the validatable supplier.
        Returns:
        the expected result after successful validation
      • isEmptyCollection

        protected boolean isEmptyCollection​(java.util.Collection<?> c)
        Verifies whether the collection is empty or not.
      • setValidationErrorsProvider

        public void setValidationErrorsProvider​(ValidationErrorsProvider validationErrorsProvider)