Jackson注解@get:JsonValue,相当于GSON

Jackson annotation @get:JsonValue, GSON equivalent

杰克逊的 @get:JsonValue 是否有 GSON 等效注释?

我有下面的枚举,我也需要 GSON 注释。

enum class TransactionType(@get:JsonValue val code: Int) { ... }

是:

enum class Type(@get:JsonValue val code: Int, val description: String) {
    @SerializedName("0") NEGATIVE(2, "negative amount "),
    @SerializedName("1") CREDIT(3,"Credit."),
    @SerializedName("2") WAGERS(6,"wager"),
    @SerializedName("3") ZERO(8, "zero.")
}

参考: https://javadoc.io/doc/com.google.code.gson/gson/2.8.1/com/google/gson/annotations/package-summary.html