From 211840e5d6a1d96f569dcd043dff8e658b795fbd Mon Sep 17 00:00:00 2001 From: GoFly233 Date: Thu, 13 Aug 2020 20:26:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor(SignResultBean.java):=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20Kotlin=20=E9=87=8D=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tieba/api/models/SignResultBean.kt | 92 ++++++------------- 1 file changed, 29 insertions(+), 63 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/api/models/SignResultBean.kt b/app/src/main/java/com/huanchengfly/tieba/api/models/SignResultBean.kt index f04459d0..08ec9ea8 100644 --- a/app/src/main/java/com/huanchengfly/tieba/api/models/SignResultBean.kt +++ b/app/src/main/java/com/huanchengfly/tieba/api/models/SignResultBean.kt @@ -1,81 +1,47 @@ -package com.huanchengfly.tieba.api.models; +package com.huanchengfly.tieba.api.models -import com.google.gson.annotations.SerializedName; -import com.huanchengfly.tieba.post.models.BaseBean; -import com.huanchengfly.utils.GsonUtil; +import com.google.gson.annotations.SerializedName +import com.huanchengfly.tieba.post.models.BaseBean +import com.huanchengfly.utils.GsonUtil -public class SignResultBean extends BaseBean { +class SignResultBean : BaseBean() { @SerializedName("user_info") - private UserInfo userInfo; + val userInfo: UserInfo? = null + @SerializedName("error_code") - private String errorCode; + val errorCode: String? = null + + fun getErrorCode() = Integer.valueOf(errorCode!!) + @SerializedName("error_msg") - private String errorMsg; - private long time; + val errorMsg: String? = null + val time: Long? = null - public String getErrorMsg() { - return errorMsg; + override fun toString(): String { + return GsonUtil.getGson().toJson(this) } - public UserInfo getUserInfo() { - return userInfo; - } - - public int getErrorCode() { - return Integer.valueOf(errorCode); - } - - public long getTime() { - return time; - } - - @Override - public String toString() { - return GsonUtil.getGson().toJson(this); - } - - public class UserInfo extends BaseBean { + inner class UserInfo : BaseBean() { @SerializedName("user_id") - private String userId; + val userId: String? = null + @SerializedName("is_sign_in") - private String isSignIn; + val isSignIn: String? = null + @SerializedName("user_sign_rank") - private String userSignRank; + val userSignRank: String? = null + @SerializedName("sign_time") - private String signTime; + val signTime: String? = null + @SerializedName("sign_bonus_point") - private String signBonusPoint; + val signBonusPoint: String? = null + @SerializedName("level_name") - private String levelName; + val levelName: String? = null + @SerializedName("levelup_score") - private String levelUpScore; + val levelUpScore: String? = null - public String getUserId() { - return userId; - } - - public String getIsSignIn() { - return isSignIn; - } - - public String getUserSignRank() { - return userSignRank; - } - - public String getSignTime() { - return signTime; - } - - public String getSignBonusPoint() { - return signBonusPoint; - } - - public String getLevelName() { - return levelName; - } - - public String getLevelUpScore() { - return levelUpScore; - } } } \ No newline at end of file