json - How to validate a pojo in play framework 2.3.x java application? -


I instantiate a pojo with incoming Jason data. After Pojo is generated, I want to validate that there are all the necessary fields of pojo I have marked the class using the game from @ mandatory annotation, but I am not able to trigger verification on it I am Is this the right way?

The following model package is my pojo.

  public class employee {@ requirement (message = "name is required") private string name; @ Essential (message = "id is required") private integer ID; }  

In the controller class, I use the following code to pause my json request

  employee newUser = Json.fromJson (request). (). Ejason (), employee category);  

Now after this I want to validate pojo so that name or id is not lost by request.

There is an entry in my routes

  post / say filter controller. Application. Hello ()  

How to get it?


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -