在从Java瞬时或@Transient标注在JSON序列隐藏属性最好的方法? [英] Best method in hiding attribute in JSON serialization from java transient or @Transient annotation?

查看:895
本文介绍了在从Java瞬时或@Transient标注在JSON序列隐藏属性最好的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Spring中,ExtJS的应用程序,我用Java对象的JSON序列化。当我想排除JSON的属性,我用 @Transient 注释。

In Spring, ExtJs application I use JSON serialization of java objects. When I want to exclude a property from JSON, I use @Transient annotation.

我看的java 瞬态关键字也与此。我想知道哪些是最好的,更高效的性能角度和安全性。

I see java transient keyword also works with this. I like to know which of these are best and more efficient in performance perspective and security.

推荐答案

我preFER使用基于注解的映射。因为这可能取决于你JSON解析器API。因此,有可能是java之间的差异注释 VS @Transient

I prefer to use annotation based mapping. Because this may dependent on you JSON parser API. So, there can be variations between java annotation Vs @Transient.

这篇关于在从Java瞬时或@Transient标注在JSON序列隐藏属性最好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆