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

This commit is contained in:
GoFly233 2020-08-13 20:28:27 +08:00 committed by HuanChengFly
parent fe1df9e6ec
commit e22a9b3022
2 changed files with 143 additions and 406 deletions

View File

@ -1,483 +1,220 @@
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.api.adapters.SubPostListAdapter; import com.huanchengfly.tieba.api.adapters.SubPostListAdapter
import com.huanchengfly.tieba.post.models.BaseBean; import com.huanchengfly.tieba.post.models.BaseBean
import java.util.List; class ThreadContentBean : BaseBean() {
public class ThreadContentBean extends BaseBean {
@SerializedName("error_code") @SerializedName("error_code")
private String errorCode; val errorCode: String? = null
@SerializedName("error_msg") @SerializedName("error_msg")
private String errorMsg; val errorMsg: String? = null
@SerializedName("post_list") @SerializedName("post_list")
private List<PostListItemBean> postList; val postList: List<PostListItemBean>? = null
private PageInfoBean page; val page: PageInfoBean? = null
private UserInfoBean user; val user: UserInfoBean? = null
private ForumInfoBean forum; val forum: ForumInfoBean? = null
@SerializedName("display_forum") @SerializedName("display_forum")
private ForumInfoBean displayForum; val displayForum: ForumInfoBean? = null
@SerializedName("has_floor") @SerializedName("has_floor")
private String hasFloor; val hasFloor: String? = null
@SerializedName("is_new_url") @SerializedName("is_new_url")
private String isNewUrl; val isNewUrl: String? = null
@SerializedName("user_list") @SerializedName("user_list")
private List<UserInfoBean> userList; val userList: List<UserInfoBean>? = null
private ThreadBean thread; val thread: ThreadBean? = null
private AntiInfoBean anti; val anti: AntiInfoBean? = null
public String getErrorCode() { class AntiInfoBean {
return errorCode; val tbs: String? = null
} }
public String getErrorMsg() { class ThreadInfoBean {
return errorMsg;
}
public List<PostListItemBean> getPostList() {
return postList;
}
public PageInfoBean getPage() {
return page;
}
public UserInfoBean getUser() {
return user;
}
public ForumInfoBean getForum() {
return forum;
}
public ForumInfoBean getDisplayForum() {
return displayForum;
}
public String getHasFloor() {
return hasFloor;
}
public String getIsNewUrl() {
return isNewUrl;
}
public List<UserInfoBean> getUserList() {
return userList;
}
public ThreadBean getThread() {
return thread;
}
public AntiInfoBean getAnti() {
return anti;
}
public static class AntiInfoBean {
private String tbs;
public String getTbs() {
return tbs;
}
}
public static class ThreadInfoBean {
@SerializedName("thread_id") @SerializedName("thread_id")
private String threadId; val threadId: String? = null
@SerializedName("first_post_id") @SerializedName("first_post_id")
private String firstPostId; val firstPostId: String? = null
public String getThreadId() {
return threadId;
}
public String getFirstPostId() {
return firstPostId;
}
} }
public static class AgreeBean { class AgreeBean {
@SerializedName("agree_num") @SerializedName("agree_num")
private String agreeNum; val agreeNum: String? = null
@SerializedName("disagree_num") @SerializedName("disagree_num")
private String disagreeNum; val disagreeNum: String? = null
@SerializedName("diff_agree_num") @SerializedName("diff_agree_num")
private String diffAgreeNum; val diffAgreeNum: String? = null
@SerializedName("has_agree") @SerializedName("has_agree")
private String hasAgree; val hasAgree: String? = null
public String getAgreeNum() {
return agreeNum;
}
public String getDisagreeNum() {
return disagreeNum;
}
public String getDiffAgreeNum() {
return diffAgreeNum;
}
public String getHasAgree() {
return hasAgree;
}
} }
public static class ThreadBean { class ThreadBean {
private String id; val id: String? = null
private String title; val title: String? = null
@SerializedName("thread_info") @SerializedName("thread_info")
private ThreadInfoBean threadInfo; val threadInfo: ThreadInfoBean? = null
private UserInfoBean author; val author: UserInfoBean? = null
@SerializedName("reply_num") @SerializedName("reply_num")
private String replyNum; val replyNum: String? = null
@SerializedName("collect_status") @SerializedName("collect_status")
private String collectStatus; val collectStatus: String? = null
@SerializedName("agree_num") @SerializedName("agree_num")
private String agreeNum; val agreeNum: String? = null
@SerializedName("post_id") @SerializedName("post_id")
private String postId; val postId: String? = null
@SerializedName("thread_id") @SerializedName("thread_id")
private String threadId; val threadId: String? = null
private AgreeBean agree; val agree: AgreeBean? = null
public String getThreadId() {
return threadId;
}
public String getPostId() {
return postId;
}
public ThreadInfoBean getThreadInfo() {
return threadInfo;
}
public String getAgreeNum() {
return agreeNum;
}
public AgreeBean getAgree() {
return agree;
}
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public UserInfoBean getAuthor() {
return author;
}
public String getReplyNum() {
return replyNum;
}
public String getCollectStatus() {
return collectStatus;
}
} }
public static class UserInfoBean { class UserInfoBean {
@SerializedName("is_login") @SerializedName("is_login")
private String isLogin; val isLogin: String? = null
private String id; val id: String? = null
private String name; val name: String? = null
@SerializedName("name_show") @SerializedName("name_show")
private String nameShow; val nameShow: String? = null
@JsonAdapter(PortraitAdapter.class)
private String portrait; @JsonAdapter(PortraitAdapter::class)
private String type; val portrait: String? = null
val type: String? = null
@SerializedName("level_id") @SerializedName("level_id")
private String levelId; val levelId: String? = null
@SerializedName("is_like") @SerializedName("is_like")
private String isLike; val isLike: String? = null
@SerializedName("is_manager") @SerializedName("is_manager")
private String isManager; val isManager: String? = null
public String getIsLogin() {
return isLogin;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getNameShow() {
return nameShow;
}
public String getPortrait() {
return portrait;
}
public String getType() {
return type;
}
public String getLevelId() {
return levelId;
}
public String getIsLike() {
return isLike;
}
public String getIsManager() {
return isManager;
}
} }
public static class ForumInfoBean extends BaseBean { class ForumInfoBean : BaseBean() {
private String id; val id: String? = null
private String name; val name: String? = null
@SerializedName("is_exists") @SerializedName("is_exists")
private String isExists; val isExists: String? = null
private String avatar; val avatar: String? = null
@SerializedName("first_class") @SerializedName("first_class")
private String firstClass; val firstClass: String? = null
@SerializedName("second_class") @SerializedName("second_class")
private String secondClass; val secondClass: String? = null
@SerializedName("is_liked") @SerializedName("is_liked")
private String isLiked; val isLiked: String? = null
@SerializedName("is_brand_forum") @SerializedName("is_brand_forum")
private String isBrandForum; val isBrandForum: String? = null
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getIsExists() {
return isExists;
}
public String getAvatar() {
return avatar;
}
public String getFirstClass() {
return firstClass;
}
public String getSecondClass() {
return secondClass;
}
public String getIsLiked() {
return isLiked;
}
public String getIsBrandForum() {
return isBrandForum;
}
} }
public static class PageInfoBean { class PageInfoBean {
private String offset; val offset: String? = null
@SerializedName("current_page") @SerializedName("current_page")
private String currentPage; val currentPage: String? = null
@SerializedName("total_page") @SerializedName("total_page")
private String totalPage; val totalPage: 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 getOffset() {
return offset;
}
public String getCurrentPage() {
return currentPage;
}
public String getTotalPage() {
return totalPage;
}
public String getHasMore() {
return hasMore;
}
public String getHasPrev() {
return hasPrev;
}
} }
public static class PostListItemBean { class PostListItemBean {
private String id; val id: String? = null
private String title; val title: String? = null
private String floor; val floor: String? = null
private String time; val time: String? = null
private List<ContentBean> content; val content: List<ContentBean>? = null
@SerializedName("author_id") @SerializedName("author_id")
private String authorId; val authorId: String? = null
private UserInfoBean author; val author: UserInfoBean? = null
@SerializedName("sub_post_number") @SerializedName("sub_post_number")
private String subPostNumber; val subPostNumber: String? = null
@SerializedName("sub_post_list") @SerializedName("sub_post_list")
@JsonAdapter(SubPostListAdapter.class) @JsonAdapter(SubPostListAdapter::class)
private SubPostListBean subPostList; val subPostList: SubPostListBean? = null
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public String getFloor() {
return floor;
}
public String getTime() {
return time;
}
public List<ContentBean> getContent() {
return content;
}
public String getAuthorId() {
return authorId;
}
public UserInfoBean getAuthor() {
return author;
}
public String getSubPostNumber() {
return subPostNumber;
}
public SubPostListBean getSubPostList() {
return subPostList;
}
} }
public static class SubPostListBean { class SubPostListBean {
private String pid; val pid: String? = null
@SerializedName("sub_post_list") @SerializedName("sub_post_list")
private List<PostListItemBean> subPostList; val subPostList: List<PostListItemBean>? = null
public String getPid() {
return pid;
}
public List<PostListItemBean> getSubPostList() {
return subPostList;
}
} }
public static class ContentBean { class ContentBean {
private String type; val type: String? = null
private String text; var text: String? = null
private String link; private set
private String src; val link: String? = null
private String uid; val src: String? = null
val uid: String? = null
@SerializedName("origin_src") @SerializedName("origin_src")
private String originSrc; val originSrc: String? = null
@SerializedName("cdn_src") @SerializedName("cdn_src")
private String cdnSrc; val cdnSrc: String? = null
@SerializedName("cdn_src_active") @SerializedName("cdn_src_active")
private String cdnSrcActive; val cdnSrcActive: String? = null
@SerializedName("big_cdn_src") @SerializedName("big_cdn_src")
private String bigCdnSrc; val bigCdnSrc: String? = null
@SerializedName("during_time") @SerializedName("during_time")
private String duringTime; val duringTime: String? = null
private String bsize; val bsize: String? = null
private String c; val c: String? = null
private String width; val width: String? = null
private String height; val height: String? = null
@SerializedName("is_long_pic") @SerializedName("is_long_pic")
private String isLongPic; val isLongPic: String? = null
@SerializedName("voice_md5") @SerializedName("voice_md5")
private String voiceMD5; val voiceMD5: String? = null
public String getCdnSrc() { fun setText(text: String?): ContentBean {
return cdnSrc; this.text = text
return this
} }
public String getCdnSrcActive() {
return cdnSrcActive;
}
public String getBigCdnSrc() {
return bigCdnSrc;
}
public String getUid() {
return uid;
}
public String getVoiceMD5() {
return voiceMD5;
}
public String getDuringTime() {
return duringTime;
}
public String getIsLongPic() {
return isLongPic;
}
public String getType() {
return type;
}
public String getText() {
return text;
}
public ContentBean setText(String text) {
this.text = text;
return this;
}
public String getLink() {
return link;
}
public String getSrc() {
return src;
}
public String getOriginSrc() {
return originSrc;
}
public String getBsize() {
return bsize;
}
public String getC() {
return c;
}
public String getWidth() {
return width;
}
public String getHeight() {
return height;
}
} }
} }