简体   繁体   English

注释类型 SerializedName 的属性“alternate”未定义

[英]The attribute “alternate” is undefined for the annotation type SerializedName

I am using com.google.gson.annotations.SerializedName with elements "value" and "alternate" as mentioned in gson docs @SerializedName(value= "Active", alternate = {"Active","Pending"}) , but the compiler says error: "The attribute alternate is undefined for the annotation type SerializedName". I am using com.google.gson.annotations.SerializedName with elements "value" and "alternate" as mentioned in gson docs @SerializedName(value= "Active", alternate = {"Active","Pending"}) , but the编译器显示错误:“注释类型 SerializedName 的属性备用未定义”。

The alternate version of the @SerializedName annotation was added in Gson version 2.4, so will not work in earlier versions. @SerializedName注释的alternate版本是在 Gson 2.4 版中添加的,因此在早期版本中将不起作用。 It seems that occasionally the parent pom may prevent overriding the version (see above discussion).似乎有时父 pom 可能会阻止覆盖版本(参见上面的讨论)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM