加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 如何从序列化中排除GWT中的对象属性?

发布时间:2020-12-14 23:47:53 所属栏目:Java 来源:网络整理
导读:有没有办法从GWT序列化中排除Serializable对象中的原始和对象属性? public class Provider implements Serializable{ public Provider() { } //Id like to exclude this property: private String password; // private String address1; private String ad
有没有办法从GWT序列化中排除Serializable对象中的原始和对象属性?
public class Provider implements Serializable{  
    public Provider() {  
    }  

    //Id like to exclude this property:   
        private String password;  
    //  

    private String address1;  
    private String address2;  
    private String companyName;  
    private String phone;  
}

解决方法

I was hoping for something like
special annotation

我想你要找的是@GwtTransient

@GwtTransient,an annotation that
tells GWT RPC to treat a field as if
it were marked with the Java transient
keyword,even though it’s not.

This annotation means the same thing
as the transient keyword,
but it is ignored by all serialization
systems other than GWT’s. Usually the
transient keyword should be used in
preference to this annotation.
However,for types used with multiple
serialization systems,it can be
useful.

参考:@GwtTransient

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读