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

This commit is contained in:
GoFly233 2020-08-13 20:09:27 +08:00 committed by HuanChengFly
parent f3b6b4cd0a
commit e491f0a7bf
1 changed files with 62 additions and 171 deletions

View File

@ -1,212 +1,103 @@
package com.huanchengfly.tieba.api.models; package com.huanchengfly.tieba.api.models
import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.JsonAdapter
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName
import com.huanchengfly.tieba.api.adapters.PortraitAdapter; import com.huanchengfly.tieba.api.adapters.PortraitAdapter
import com.huanchengfly.tieba.post.models.BaseBean; import com.huanchengfly.tieba.post.models.BaseBean
import java.util.List; class MessageListBean : BaseBean() {
public class MessageListBean extends BaseBean {
@SerializedName("error_code") @SerializedName("error_code")
private String errorCode; val errorCode: String? = null
private long time; val time: Long = 0
@SerializedName("reply_list") @SerializedName("reply_list")
private List<MessageInfoBean> replyList; val replyList: List<MessageInfoBean>? = null
@SerializedName("at_list") @SerializedName("at_list")
private List<MessageInfoBean> atList; val atList: List<MessageInfoBean>? = null
private PageInfoBean page; val page: PageInfoBean? = null
private MessageBean message; val message: MessageBean? = null
public int getErrorCode() { fun getErrorCode() {
return Integer.valueOf(errorCode); Integer.valueOf(errorCode!!)
} }
public long getTime() { open inner class UserInfoBean {
return time; val id: String? = null
} val name: String? = null
public List<MessageInfoBean> getReplyList() {
return replyList;
}
public List<MessageInfoBean> getAtList() {
return atList;
}
public MessageBean getMessage() {
return message;
}
public PageInfoBean getPage() {
return page;
}
public class UserInfoBean {
private String id;
private String name;
@SerializedName("name_show") @SerializedName("name_show")
private String nameShow; val nameShow: String? = null
@JsonAdapter(PortraitAdapter.class)
private String portrait;
public String getId() { @JsonAdapter(PortraitAdapter::class)
return id; val portrait: String? = null
}
public String getName() {
return name;
}
public String getNameShow() {
return nameShow;
}
public String getPortrait() {
return portrait;
}
} }
public class ReplyerInfoBean extends UserInfoBean { inner class ReplyerInfoBean : UserInfoBean() {
@SerializedName("is_friend") @SerializedName("is_friend")
private String isFriend; val isFriend: String? = null
@SerializedName("is_fans") @SerializedName("is_fans")
private String isFans; val isFans: String? = null
public String getIsFriend() {
return isFriend;
}
public String getIsFans() {
return isFans;
}
} }
public class MessageInfoBean { inner class MessageInfoBean {
@SerializedName("is_floor") @SerializedName("is_floor")
private String isFloor; val isFloor: String? = null
private String title; val title: String? = null
private String content; val content: String? = null
@SerializedName("quote_content") @SerializedName("quote_content")
private String quoteContent; val quoteContent: String? = null
private ReplyerInfoBean replyer; val replyer: ReplyerInfoBean? = null
@SerializedName("quote_user") @SerializedName("quote_user")
private UserInfoBean quoteUser; val quoteUser: UserInfoBean? = null
@SerializedName("thread_id") @SerializedName("thread_id")
private String threadId; val threadId: String? = null
@SerializedName("post_id") @SerializedName("post_id")
private String postId; val postId: String? = null
private String time; val time: String? = null
@SerializedName("fname") @SerializedName("fname")
private String forumName; val forumName: String? = null
@SerializedName("quote_pid") @SerializedName("quote_pid")
private String quotePid; val quotePid: String? = null
@SerializedName("thread_type") @SerializedName("thread_type")
private String threadType; val threadType: String? = null
private String unread; val unread: String? = null
public String getUnread() {
return unread;
}
public String getIsFloor() {
return isFloor;
}
public String getTitle() {
return title;
}
public String getContent() {
return content;
}
public String getQuoteContent() {
return quoteContent;
}
public ReplyerInfoBean getReplyer() {
return replyer;
}
public UserInfoBean getQuoteUser() {
return quoteUser;
}
public String getThreadId() {
return threadId;
}
public String getPostId() {
return postId;
}
public String getTime() {
return time;
}
public String getForumName() {
return forumName;
}
public String getQuotePid() {
return quotePid;
}
public String getThreadType() {
return threadType;
}
} }
public class MessageBean { inner class MessageBean {
@SerializedName("replyme") @SerializedName("replyme")
private String replyMe; val replyMe: String? = null
@SerializedName("atme") @SerializedName("atme")
private String atMe; val atMe: String? = null
private String fans; val fans: String? = null
private String recycle; val recycle: String? = null
@SerializedName("storethread") @SerializedName("storethread")
private String storeThread; val storeThread: String? = null
public String getReplyMe() {
return replyMe;
}
public String getAtMe() {
return atMe;
}
public String getFans() {
return fans;
}
public String getRecycle() {
return recycle;
}
public String getStoreThread() {
return storeThread;
}
} }
public class PageInfoBean { inner class PageInfoBean {
@SerializedName("current_page") @SerializedName("current_page")
private String currentPage; val currentPage: String? = null
@SerializedName("has_more") @SerializedName("has_more")
private String hasMore; val hasMore: String? = null
@SerializedName("has_prev") @SerializedName("has_prev")
private String hasPrev; val hasPrev: String? = null
public String getHasMore() {
return hasMore;
}
public String getHasPrev() {
return hasPrev;
}
public String getCurrentPage() {
return currentPage;
}
} }
} }