Skip to content
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

对于ExtraProcessor的使用 #555

Closed
wangsuicheng opened this issue Apr 19, 2016 · 3 comments
Closed

对于ExtraProcessor的使用 #555

wangsuicheng opened this issue Apr 19, 2016 · 3 comments
Milestone

Comments

@wangsuicheng
Copy link

wangsuicheng commented Apr 19, 2016

比如我有个A类,其中有字段List<B> listVar,B类中有个特殊的类字段spec(这字段是来自某一个jar包的,没有提供无参的默认构造函数),我toJsonString时用了ValueFilter把这个特殊类序列化成一个有带有指定符号的String,整体序列化是能成功,但是用ExtraProcessor时: //不知道这样传入对不对
JSON.parseObject(testAString, A.class, new ProcessorContainer());
在这个ProcessorContainer里面,我通过判断value值如果含有指定符号,我才自己处理这个spec

p.s 这个spec我失能了反序列化
@JSONField(serialize = true, deserialize = false)
Spec spec;

现在错误是Spec default constructor not found,因为这个Spec没有提供无参的默认构造函数(new Spec()肯定失败 ),我失能了反序列化,fastjson也要去拜访这个特殊的类,然后new Spec()吗?按理来说不应该吧~~~

@wenshao
Copy link
Member

wenshao commented Apr 19, 2016

是否可以提供重现问题的testcase

@wangsuicheng
Copy link
Author

wangsuicheng commented Apr 23, 2016

public class A{
...
List<B> listVar
...
}
public class B{
...
@JSONField(serialize = true, deserialize = false)
Spec spec;//来自某一个jar包,没有提供无参的默认构造函数,即public Spec(){}
...
}
如果我deserialize了这个filed,那么在fastjson里反序列化时,就不该去new Spec()了吧,不然肯定遇到
错误Spec default constructor not found,你们后续的版本能判断如果某个field deserialize了,就不用去new xxx() 了吧?

@wenshao wenshao modified the milestones: 1.2.11, 1.2.12 Apr 25, 2016
@wenshao
Copy link
Member

wenshao commented May 21, 2016

已经解决,将会在这两天内发布1.2.12版本解决此问题

@wenshao wenshao closed this as completed May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants