如何使用 Eclipselink Converter 将对象列表序列化为 json
我已经编写了 Converter 的实现,它使用 Jackson JSON 将深度结构化对象列表序列化为 JSON,但它没有被调用。我这样做正确吗?
@Converter(name="arrayList", converterClass=ArrayListJsonSerializedObjectConverter.class)
private List<DeeplyStructuredObject> deeplyStructuredObjects= new ArrayList<DeeplyStructuredObject>();
另外,我想知道除了 ReadTransfomer 之外是否还可以使用 ReadTransfomer 同一属性上的转换器,例如
@Converter(name="arrayList", converterClass=ArrayListJsonSerializedObjectConverter.class)
@ReadTransformer(method="someMethod")
private List<DeeplyStructuredObject> deeplyStructuredObjects= new ArrayList<DeeplyStructuredObject>();
I've written a implementation of Converter that uses Jackson JSON to serialize a list of deeply structured objects to JSON, but it's not being called. Am I doing this correctly?
@Converter(name="arrayList", converterClass=ArrayListJsonSerializedObjectConverter.class)
private List<DeeplyStructuredObject> deeplyStructuredObjects= new ArrayList<DeeplyStructuredObject>();
Additionally, I'd like to know whether or not one can use a ReadTransfomer in addition to a
Converter on the same property, e.g.
@Converter(name="arrayList", converterClass=ArrayListJsonSerializedObjectConverter.class)
@ReadTransformer(method="someMethod")
private List<DeeplyStructuredObject> deeplyStructuredObjects= new ArrayList<DeeplyStructuredObject>();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论