26 Java Serialization using transient keyword Theory
backstreetbrogrammer Chapter 12 Serialization using transient keyword Suppose one of the objects in the object graph is not accessible (meaning we cant modify it due to permission issues) and not marked as Serializable. In that case, are we blocked to serialize our main class which has reference to that readonly object One option is to subclass that readonly class, but it may be marked as final. OR, we dont know if the readonly class object has other similar objects in its own object graph. There are other private members fields (primitive and reference) of a class which contains sensitive data like passwords, or it doesnt make sense to serialize it like the state of an inmemory Thread. Thats where the transient modifier comes in. By marking the members fields (primitive and reference) as transi
|
|