-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
不论是在@JSONField还是@JSONType中自定义Enum反序列化器都是无效的 #2179
Comments
@JSONType(serializeEnumAsJavaBean = true) enum上要加这个配置 |
我在1.2.58这个版本上,@jsontype(serializeEnumAsJavaBean = true)添加了这个配置依然不起作用啊 |
Omega-Ariston
added a commit
to Omega-Ariston/fastjson
that referenced
this issue
Sep 4, 2019
Omega-Ariston
added a commit
to Omega-Ariston/fastjson
that referenced
this issue
Sep 4, 2019
1.2.60同样存在 是否与我下面使用的方法有关?
/**
* @since 1.2.23
*/
public <T> List<T> toJavaList(Class<T> clazz) {
List<T> list = new ArrayList<T>(this.size());
ParserConfig config = ParserConfig.getGlobalInstance();
for (Object item : this) {
T classItem = (T) TypeUtils.cast(item, clazz, config);
list.add(classItem);
}
return list;
} |
经过尝试,发现只有parse、parseArray、parseObject等解析方法反序列化才生效。 getObject、toJavaObject、toJavaList等转化方法中反序列化不生效 |
如何只在枚举实现的接口上面添加注解,从而实现全局的反序列操作? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
温少:
前言:因为项目中的enum类统一需要实现接口EnumAware(提供getCode()、getPrompt())
即便找到了我自定义的解析器,却没有使用它,而是定死了解析方式。
The text was updated successfully, but these errors were encountered: