BomberStudentReponse.java 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package rsx;
  2. import org.json.JSONObject;
  3. /**
  4. * Analyse reponse d'un serveur BomberStudent
  5. * @author Arthur Brandao
  6. */
  7. public class BomberStudentReponse {
  8. protected boolean error = true;
  9. protected int statut;
  10. protected String message;
  11. protected JSONObject reponse;
  12. /* --- Constructeurs --- */
  13. public BomberStudentReponse(){
  14. }
  15. public BomberStudentReponse(String reponse){
  16. this.error = false;
  17. //Parse reponse
  18. JSONObject json = new JSONObject(reponse);
  19. this.statut = json.getInt("statut");
  20. this.message = json.getString("message");
  21. this.reponse = json.getJSONObject("param");
  22. }
  23. /* --- Getter/Setter --- */
  24. public boolean isError() {
  25. return error;
  26. }
  27. public void setError(boolean error) {
  28. this.error = error;
  29. }
  30. public int getStatut() {
  31. return statut;
  32. }
  33. public void setStatut(int statut) {
  34. this.statut = statut;
  35. }
  36. public String getMessage() {
  37. return message;
  38. }
  39. public void setMessage(String message) {
  40. this.message = message;
  41. }
  42. public JSONObject getReponse() {
  43. return reponse;
  44. }
  45. public void setReponse(JSONObject reponse) {
  46. this.reponse = reponse;
  47. }
  48. }