为了支持model中自定义的get set方法能生成json,项目里面设置了me.setJsonFactory(new FastJsonFactory());
但是项目里面有些对象是Record或者是model直接put进去的值,这样用renderJson就不显示了。求教大神如何解决两种情况都能支持的最佳方案。
代码片段如下:
me.setJsonFactory(new FastJsonFactory());
-------------------------------------------------------------------
public class Member extends BaseMember<Member> {
public String getFullName(){
return this.getFirstName() + this.getLastName();
}
}
----------------------------------------------------------
Member member = memberService.find(1);
member.put("projectList",projectService.getByUserId(1));
renderJson(member);
me.setJsonFactory(new MixedJsonFactory());