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