mercredi 30 août 2017

Java Passing Parameters Best Practice

Which approach is the best practice in Java - ORM - RestFul Services?

1-Get a User JSON from a Client

2-Create a User object like : User user = JSON_to_User_Object_method

3-Call the service method to add user, and pass the User object like : service.addUser(User user)

or

1-Get a User JSON from a Client

2-Call the service method to add user but pass the Json values to the service's method like : service.addUser(jsonobject.name, jsonobject.surname, ......)

3-And handle the other stuff in the service method named addUser,(create User Pojo, end persist and so on..)

Aucun commentaire:

Enregistrer un commentaire