JSR 303 based validation for Dolphin Platform #10

merged 5 commits into from Jan 22, 2016


None yet

2 participants


Dolphin Platform Bean Validation

This module adds bean validation (JSR 303) support to the property API of the Dolphin Platform.
Dolphin Platform Logo

In this first pull request not all validation annotations that are part of JSR 303 are implemented. Additional implementation can be done by a second pull request. This Pull request is more about discussing the API and integration.

Properties and collections that are defined in Dolphin Platform models can be annotated by a Bean Validation constraint annotation. It's plan to support all the default JSR-303 annotations by simply adding this module.
The module based on a plugin mechanism for JSR-303 and therefore you only need to add the dependency to your project to use the validation support:


The module don't depend on a JSR-303 implementation. If your application server don't provide an implementation you need to add for example Hibernate Validation as a dependency. Here is an example for Maven:


By doing so you can create a Dolphin Platform based model that looks like this:

public class MyModel {

    private Property<String> value;

    public Property<String> valueProperty() {
        return value1;

By using a validator you can now easily validate instances of the model as described in the bean validation documentation or several tutorials. Here is a basic code snippet that creates a validator by hand and validates a Dolphin Platform model:

Configuration<?> validationConf = Validation.byDefaultProvider().configure();
Validator validator = validationConf.buildValidatorFactory().getValidator();
Set<ConstraintViolation<TestBean>> violations = validator.validate(dolphinModel);
if(!violations.isEmpty()) {
    //Handle violations

Review on Reviewable

hendrikebbers added some commits Dec 15, 2015
@hendrikebbers hendrikebbers several validators ff73375
@hendrikebbers hendrikebbers documentation

never throw RuntimeException. Use a framework/domain specific exception instead


would it make sense to make this class (and others like it) final?

@hendrikebbers hendrikebbers added this to the 0.8.0 milestone Jan 22, 2016
hendrikebbers added some commits Jan 22, 2016
@hendrikebbers hendrikebbers Merge branch 'master' into validation
@hendrikebbers hendrikebbers changes based on review
@hendrikebbers hendrikebbers header
@hendrikebbers hendrikebbers merged commit 4a0332a into master Jan 22, 2016

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed
coverage/coveralls Coverage increased (+1.0%) to 14.973%
@hendrikebbers hendrikebbers deleted the validation branch Jan 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment