I need to validate mandatory fields in my class
For example, 9
fields must not be null
.
I need to check if they are all null but I
Basically, there are two ways here:
I would heavily recommend to look into bean validation:
Define your classes that carry information as beans. And then use the wide range of annotations to mark the corresponding fields. And then use some existing framework to do the validation for you. You can even define your own annotations there, that run your own code.