Skip to content
Patrick Moawad edited this page Dec 13, 2017 · 66 revisions

GitHub version Build Status

The ValidationFramework is a simple and flexible framework mainly (but not strictly) designed to validate user input and provide appropriate feedback. Currently supporting Swing and (partially) JavaFX by default, it can be easily extended for other purposes and frameworks.

This page gives some general information about the project.

Goal

Most of Java validation frameworks and engines available on the internet have at least one of the following caveats:

  • They are very simple to use, but not flexible enough: their limit is quickly reached;
  • They are very flexible, but tend to be complex to use: they require a lot of configuration and/or code to be written to achieve goals;
  • They do not cover the whole process of validation, from the moment it is triggered till the end processing of the results;
  • They are not free and/or open-source, or their license is not permissive enough to integrate with other projects and to be used in commercial products.

The ValidationFramework is meant to overcome all these issues. The ultimate goal is to be very flexible, and yet very easy and ready to use, to cover the whole validation process from A to Z, and to be available under a permissive license.

Description

The ValidationFramework is a set of base classes, interfaces and utilities to help in implementing full-featured validation in Java. Although it is mainly targeted for validation of user input, it can be applied to other domains as well.

The ValidationFramework provides facilities to implement the complete validation process from the moment it is triggered, till the processing of the validation result(s). It is based on the following five concepts:

  1. Triggers: they trigger the whole validation process (for instance, whenever the user presses a key, whenever some data needs to be stored in a database, etc.);
  2. Data Providers: they read, gather and provide the data to be validated whenever the validation process is triggered (for instance, reading a value from an input field, retrieving some data from a database, etc.);
  3. Rules: they validate the data provided by the data providers (for instance, checking the length of a string, checking that some data is of a specific type, checking that a value is within a specific range, checking that an XML string matches an XSD schema, etc.) and produce validation results (for instance, string too long, value valid, value invalid, value out of range, parse error at a specific line, etc.);
  4. Result Handlers: they perform some action based on the validation results produced by the rules (for instance, giving feedback to the user by showing an error dialog, enabling/disabling some components, logging errors, connecting to a server, etc.).
  5. Validators: they glue everything together.

Additionally, the ValidationFramework provides the following concepts:

  1. Properties: they are observable values, sets, lists and maps that can be used in a binding mechanism to help in implementing dynamic conditional logic (for instance, enabling/disabling components whenever some properties change, changing the value of components based on some other properties, etc.).
  2. Transformers: they transform data on-demand (for instance, casting, calling toString(), unit conversion, etc.), and can be used to transform the input and/or output of data providers, rules, result handlers and properties.

Documentation

Project access

License

The ValidationFramework is provided under the Simplified BSD License (2-clause).

Clone this wiki locally