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

前端之家收集整理的这篇文章主要介绍了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@H_403_18@,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@H_403_18@ keyword,
but it is ignored by all serialization
systems other than GWT’s. Usually the
transient@H_403_18@ keyword should be used in
preference to this annotation.
However,for types used with multiple
serialization systems,it can be
useful.

参考:@GwtTransient

原文链接:https://www.f2er.com/java/127216.html

猜你在找的Java相关文章