refactor(SignResultBean.java): 使用 Kotlin 重写

This commit is contained in:
GoFly233 2020-08-13 20:26:27 +08:00 committed by HuanChengFly
parent 2bb06f0b94
commit 211840e5d6
1 changed files with 29 additions and 63 deletions

View File

@ -1,81 +1,47 @@
package com.huanchengfly.tieba.api.models; package com.huanchengfly.tieba.api.models
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName
import com.huanchengfly.tieba.post.models.BaseBean; import com.huanchengfly.tieba.post.models.BaseBean
import com.huanchengfly.utils.GsonUtil; import com.huanchengfly.utils.GsonUtil
public class SignResultBean extends BaseBean { class SignResultBean : BaseBean() {
@SerializedName("user_info") @SerializedName("user_info")
private UserInfo userInfo; val userInfo: UserInfo? = null
@SerializedName("error_code") @SerializedName("error_code")
private String errorCode; val errorCode: String? = null
fun getErrorCode() = Integer.valueOf(errorCode!!)
@SerializedName("error_msg") @SerializedName("error_msg")
private String errorMsg; val errorMsg: String? = null
private long time; val time: Long? = null
public String getErrorMsg() { override fun toString(): String {
return errorMsg; return GsonUtil.getGson().toJson(this)
} }
public UserInfo getUserInfo() { inner class UserInfo : BaseBean() {
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 {
@SerializedName("user_id") @SerializedName("user_id")
private String userId; val userId: String? = null
@SerializedName("is_sign_in") @SerializedName("is_sign_in")
private String isSignIn; val isSignIn: String? = null
@SerializedName("user_sign_rank") @SerializedName("user_sign_rank")
private String userSignRank; val userSignRank: String? = null
@SerializedName("sign_time") @SerializedName("sign_time")
private String signTime; val signTime: String? = null
@SerializedName("sign_bonus_point") @SerializedName("sign_bonus_point")
private String signBonusPoint; val signBonusPoint: String? = null
@SerializedName("level_name") @SerializedName("level_name")
private String levelName; val levelName: String? = null
@SerializedName("levelup_score") @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;
}
} }
} }