java - How to use `transient` members? -
i have serialized class transient members. not sure how use members.
public class clientbeanbase extends beanbase { protected rewsstubclient getservicestub( boolean initsession ) { rewsstubclient stub = null; stub = (rewsstubclient) sessionvars.get(constants.session_key_stub) ... } my base class is:
public class beanbase implements serializable { protected transient map<string,object> sessionvars = ...; ... } i see sessionvars being null in getservicestub.
confused when can use sessionvarsin clientbeanbase?
you can use sessionvars whenever like.
the thing transient keyword does, tell jvm not serialize particular field in case of object serialization. in other words, reset it's default value when object recreated.
Comments
Post a Comment