Преглед на файлове

[공통][New] Object 형 API Result Bean 추가

hyodong.min преди 7 години
родител
ревизия
c77bd2e041

+ 1 - 13
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/BucketListResultBean.java

@@ -3,8 +3,6 @@
  */
 package kr.co.zumo.app.lifeplus.bean.api;
 
-import com.google.gson.annotations.SerializedName;
-
 /**
  * BookmarkResultBean
  * <pre>
@@ -15,15 +13,5 @@ import com.google.gson.annotations.SerializedName;
  * @history 민효동   [2018. 11. 6.]   [최초 작성]
  * @since 2018. 11. 6.
  */
-public class BucketListResultBean extends LifeplusAPIBean {
-  @SerializedName("data")
-  private BucketListBean data;
-
-  public BucketListBean getData() {
-    return data;
-  }
-
-  public void setData(BucketListBean data) {
-    this.data = data;
-  }
+public class BucketListResultBean extends LifeplusAPIResultObjectBean<BucketListBean> {
 }

+ 34 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/LifeplusAPIResultObjectBean.java

@@ -0,0 +1,34 @@
+/*
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
+ */
+package kr.co.zumo.app.lifeplus.bean.api;
+
+import com.google.gson.annotations.SerializedName;
+
+import kr.co.zumo.app.lifeplus.bean.JsonBeanBase;
+
+/**
+ * LifeplusAPIResultBean
+ * <pre>
+ * </pre>
+ *
+ * @author 민효동
+ * @version 1.0
+ * @history 민효동   [2018. 11. 7.]   [최초 작성]
+ * @since 2018. 11. 7.
+ */
+public class LifeplusAPIResultObjectBean<T extends JsonBeanBase> extends LifeplusAPIBean {
+  @SerializedName("data")
+  private T data;
+
+  public T getData() {
+    if (null == data) {
+      setData((T) new LifeplusAPIBean());
+    }
+    return data;
+  }
+
+  public void setData(T data) {
+    this.data = data;
+  }
+}

+ 1 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/MemberJoinResultBean.java

@@ -13,6 +13,6 @@ package kr.co.zumo.app.lifeplus.bean.api;
  * @history 민효동   [2018. 10. 1.]   [최초 작성]
  * @since 2018. 10. 1.
  */
-public class MemberJoinResultBean extends LifeplusAPIResultBean<MemberJoinDataBean> {
+public class MemberJoinResultBean extends LifeplusAPIResultObjectBean<MemberJoinDataBean> {
 
 }

+ 5 - 3
app/src/sandbox/java/kr/co/zumo/app/lifeplus/network/api/LifeplusAPIService.java

@@ -113,9 +113,11 @@ public class LifeplusAPIService implements LifeplusAPI {
   public Single<MemberJoinResultBean> insertMember(MemberJoinRequestBean bean) {
     return Single.fromCallable(() -> {
       String result = "{\n" +
-        "  \"sp_rtn\":0,\n" +
-        "  \"rtn_message\":\"성공\",\n" +
-        "  \"data\": [{\"userNo\": \"201810050000000007\"}]\n" +
+        "  \"data\": {\n" +
+        "    \"userNo\": \"201811150001008102\",\n" +
+        "  },\n" +
+        "  \"rtn_message\": \"성공\",\n" +
+        "  \"sp_rtn\": 0\n" +
         "}";
 
       return new Gson().fromJson(result, MemberJoinResultBean.class);