Skip to content
Han edited this page Oct 22, 2021 · 9 revisions

Welcome to the valid8or wiki!

Here you can find the documentation and examples for this library.

What is Valid8or

Valid8or is a lightweight java validation library.

Features:

  • Readable interface
  • Fluent builder style DSL, which guides the user to the correct options, reducing hidden ordering usage
  • Create multiple and easy to read validation rules
  • It uses predicate lambdas for rules, and specific exceptions with an exception message for each validation rule, with access to the input.
  • Instead of stating a specific exception, you can just specify an exception message and a default exception will be used.
  • You can also add a consumer (ie a logger) to capture the information when the validation fails.
  • After validating, can return the input or an optional input
  • Methods that check if the input is valid or invalid, and a list of the validations that failed
  • Set of simple predicates to use for validation rules
  • Validating using the notification pattern, where all validation rules that fail will have their exception message included in a default or custom exception

The aim of this library is to have a DSL that makes it easy to write complex validation rules and depending on your use case if one or all rules fail an exception is thrown.

The current implementation allows the user to:

Must Satisfy

  • Apply multiple validation rules to some input. If one validation rule fails then its corresponding exception will be thrown. If all rules pass then the input is valid and input is returned or wrapped in an optional
  • Apply multiple validation rules to some input. If at least one validation rule fails, then all the corresponding exceptions messages will be grouped together and thrown under one exception (either default or custom). See Notification pattern
  • Apply multiple validation rules to some input. If at least one validation rule fails, then all the corresponding exceptions messages will be grouped together and returned as a collection.
  • An optional consumer can be applied, which has access to the exception, exception message, and input

Could Satisfy

  • Apply multiple validation rules to some input. If all validation rule fails then its corresponding exception will be thrown. If one validation rule passe then the input is valid and input is returned or wrapped in an optional
  • Apply multiple validation rules to some input. If all validation rule fails, then all the corresponding exceptions messages will be grouped together and thrown under one exception (either default or custom). See Notification pattern
  • Apply multiple validation rules to some input. If all validation rule fails, then all the corresponding exceptions messages will be grouped together and returned as a collection.
  • An optional consumer can be applied, which has access to the exception, exception message, and input

Clone this wiki locally