微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

有没有办法从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

原文地址:https://www.jb51.cc/java/127216.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐