Răsfoiți Sursa

:tada: Ajout class BomberStudentReponse

Arthur Brandao 6 ani în urmă
părinte
comite
9cd77461c0
1 a modificat fișierele cu 58 adăugiri și 0 ștergeri
  1. 58 0
      Client/rsx/BomberStudentReponse.java

+ 58 - 0
Client/rsx/BomberStudentReponse.java

@@ -1,9 +1,67 @@
 package rsx;
 
+import org.json.JSONObject;
+
 /**
  * Analyse reponse d'un serveur BomberStudent
  * @author Arthur Brandao
  */
 public class BomberStudentReponse {
     
+    protected boolean error = true;
+    protected int statut;
+    protected String message;
+    protected JSONObject reponse;
+    
+    /* --- Constructeurs --- */
+    
+    public BomberStudentReponse(){
+        
+    }
+    
+    public BomberStudentReponse(String reponse){
+        this.error = false;
+        //Parse reponse
+        JSONObject json = new JSONObject(reponse);
+        this.statut = json.getInt("statut");
+        this.message = json.getString("message");
+        this.reponse = json.getJSONObject("param");
+    }  
+    
+    /* --- Getter/Setter --- */
+
+    public boolean isError() {
+        return error;
+    }
+
+    public void setError(boolean error) {
+        this.error = error;
+    }
+
+    public int getStatut() {
+        return statut;
+    }
+
+    public void setStatut(int statut) {
+        this.statut = statut;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public JSONObject getReponse() {
+        return reponse;
+    }
+
+    public void setReponse(JSONObject reponse) {
+        this.reponse = reponse;
+    }
+    
+    
+    
 }