【发布时间】:2018-12-11 21:13:17
【问题描述】:
在分页codelab中有这段代码:
/**
* Immutable model class for a Github repo that holds all the information about a repository.
* Objects of this type are received from the Github API, therefore all the fields are annotated
* with the serialized name.
* This class also defines the Room repos table, where the repo [id] is the primary key.
*/
@Entity(tableName = "repos")
data class Repo(
@PrimaryKey @field:SerializedName("id") val id: Long,
@field:SerializedName("name") val name: String,
@field:SerializedName("full_name") val fullName: String,
@field:SerializedName("description") val description: String?,
@field:SerializedName("html_url") val url: String,
@field:SerializedName("stargazers_count") val stars: Int,
@field:SerializedName("forks_count") val forks: Int,
@field:SerializedName("language") val language: String?
)
为什么需要所有这些注释?他们是做什么的?
【问题讨论】:
-
我的意思是……你看过代码注释了吗……?
标签: android serialization