In the background development process, the validation of parameters becomes an indispensable part of the development environment. For example, the parameter can not be null,email so must conform to the format of email, if manually make if judgment or write regular expression to judge the unintended development efficiency is too slow, in time, cost, quality of the game will inevitably lag behind. So the verification layer is the inevitable result of abstraction, the following is a few solutions.
The validation bean is developed based on the JSR-303 standard, is implemented using annotations, and is convenient, but this is only an interface, no specific implementation. Hibernate Validator is a hibernate standalone package that can be directly referenced, he implements the validation bean at the same time has done the expansion, relatively powerful. ( for annotations, see how the Annotation interpreter works ).
Refer to https://www.cnblogs.com/xiaogangfan/p/5987659.html, you can define your own annotations.
Bean Validator-hibernate Validator