Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Validation Frameworks

I once came across a validation framework for java, where you wrote one method that protected the integrity of the data-type and any CRUD operations on that data-type automatically called this method.

Does anyone know what this framework is? I simply want to avoid repetitive validation on every CRUD method attached to a data-type.

like image 889
bowsie Avatar asked Dec 29 '08 14:12

bowsie


People also ask

What are validation in Java?

The Bean Validation API is a Java specification which is used to apply constraints on object model via annotations. Here, we can validate a length, number, regular expression, etc. Apart from that, we can also provide custom validations. As Bean Validation API is just a specification, it requires an implementation.

What is validation framework?

The validation framework uses Spring's powerful expression evaluation engine to evaluate both validation rules and applicability conditions for the validator. As such, any valid Spring expression can be specified within the test and when attributes of any validator.

Is @valid and @validated the same?

The @Valid annotation ensures the validation of the whole object. Importantly, it performs the validation of the whole object graph. However, this creates issues for scenarios needing only partial validation. On the other hand, we can use @Validated for group validation, including the above partial validation.


2 Answers

Here's a huge list of Java Validation Libraries / Frameworks - http://java-source.net/open-source/validation

like image 198
Albert T. Wong Avatar answered Nov 12 '22 00:11

Albert T. Wong


Apache Commons has a validation framework.

like image 43
duffymo Avatar answered Nov 11 '22 23:11

duffymo