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

This commit is contained in:
GoFly233 2020-08-13 20:22:05 +08:00 committed by HuanChengFly
parent 4f339e594a
commit 37cc47b456
2 changed files with 58 additions and 116 deletions

View File

@ -1,154 +1,96 @@
package com.huanchengfly.tieba.api.models;
package com.huanchengfly.tieba.api.models
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.huanchengfly.tieba.api.adapters.ExactMatchAdapter;
import com.huanchengfly.tieba.api.adapters.ForumFuzzyMatchAdapter;
import com.huanchengfly.tieba.post.models.BaseBean;
import com.google.gson.annotations.JsonAdapter
import com.google.gson.annotations.SerializedName
import com.huanchengfly.tieba.api.adapters.ExactMatchAdapter
import com.huanchengfly.tieba.api.adapters.ForumFuzzyMatchAdapter
import com.huanchengfly.tieba.post.models.BaseBean
import java.util.List;
public class SearchForumBean extends BaseBean {
class SearchForumBean : BaseBean() {
@SerializedName("no")
private int errorCode;
val errorCode: Int? = null
@SerializedName("error")
private String errorMsg;
private DataBean data;
val errorMsg: String? = null
val data: DataBean? = null
public int getErrorCode() {
return errorCode;
}
class ExactForumInfoBean : ForumInfoBean() {
val intro: String? = null
val slogan: String? = null
public String getErrorMsg() {
return errorMsg;
}
public DataBean getData() {
return data;
}
public static class ExactForumInfoBean extends ForumInfoBean {
private String intro;
private String slogan;
@SerializedName("is_jiucuo")
private int isJiucuo;
val isJiucuo: Int? = null
public String getIntro() {
return intro;
}
public String getSlogan() {
return slogan;
}
public int getIsJiucuo() {
return isJiucuo;
}
}
public static class ForumInfoBean {
open class ForumInfoBean {
@SerializedName("forum_id")
private int forumId;
var forumId: Int? = null
@SerializedName("forum_name")
private String forumName;
var forumName: String? = null
@SerializedName("forum_name_show")
private String forumNameShow;
private String avatar;
var forumNameShow: String? = null
var avatar: String? = null
@SerializedName("post_num")
private String postNum;
var postNum: String? = null
@SerializedName("concern_num")
private String concernNum;
var concernNum: String? = null
@SerializedName("has_concerned")
private int hasConcerned;
var hasConcerned: Int? = null
public int getForumId() {
return forumId;
fun setForumId(forumId: Int): ForumInfoBean {
this.forumId = forumId
return this
}
public ForumInfoBean setForumId(int forumId) {
this.forumId = forumId;
return this;
fun setForumName(forumName: String?): ForumInfoBean {
this.forumName = forumName
return this
}
public String getForumName() {
return forumName;
fun setForumNameShow(forumNameShow: String?): ForumInfoBean {
this.forumNameShow = forumNameShow
return this
}
public ForumInfoBean setForumName(String forumName) {
this.forumName = forumName;
return this;
fun setAvatar(avatar: String?): ForumInfoBean {
this.avatar = avatar
return this
}
public String getForumNameShow() {
return forumNameShow;
fun setPostNum(postNum: String?): ForumInfoBean {
this.postNum = postNum
return this
}
public ForumInfoBean setForumNameShow(String forumNameShow) {
this.forumNameShow = forumNameShow;
return this;
fun setConcernNum(concernNum: String?): ForumInfoBean {
this.concernNum = concernNum
return this
}
public String getAvatar() {
return avatar;
}
public ForumInfoBean setAvatar(String avatar) {
this.avatar = avatar;
return this;
}
public String getPostNum() {
return postNum;
}
public ForumInfoBean setPostNum(String postNum) {
this.postNum = postNum;
return this;
}
public String getConcernNum() {
return concernNum;
}
public ForumInfoBean setConcernNum(String concernNum) {
this.concernNum = concernNum;
return this;
}
public int getHasConcerned() {
return hasConcerned;
}
public ForumInfoBean setHasConcerned(int hasConcerned) {
this.hasConcerned = hasConcerned;
return this;
fun setHasConcerned(hasConcerned: Int): ForumInfoBean {
this.hasConcerned = hasConcerned
return this
}
}
public class DataBean {
inner class DataBean {
@SerializedName("has_more")
private int hasMore;
val hasMore = 0
@SerializedName("pn")
private int page;
@JsonAdapter(ForumFuzzyMatchAdapter.class)
private List<ForumInfoBean> fuzzyMatch;
@JsonAdapter(ExactMatchAdapter.class)
private ExactForumInfoBean exactMatch;
val page = 0
public int getHasMore() {
return hasMore;
}
@JsonAdapter(ForumFuzzyMatchAdapter::class)
val fuzzyMatch: List<ForumInfoBean>? = null
public int getPage() {
return page;
}
@JsonAdapter(ExactMatchAdapter::class)
val exactMatch: ExactForumInfoBean? = null
public List<ForumInfoBean> getFuzzyMatch() {
return fuzzyMatch;
}
public ExactForumInfoBean getExactMatch() {
return exactMatch;
}
}
}
}