Skip to content

Refactor Enum classes

Now in the project there are some enums like this:

enum class IssueState {
    @SerializedName("opened") OPENED,
    @SerializedName("closed") CLOSED;

    override fun toString(): String {
        return super.toString().toLowerCase()
    }
}

but more correct code is:

enum class IssueState(private val jsonName: String) {
    @SerializedName("opened") OPENED("opened"),
    @SerializedName("closed") CLOSED("closed");

    override fun toString() = jsonName
}
Edited by Konstantin Tskhovrebov
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information