Name: rmT116609 Date: 10/09/2003
A DESCRIPTION OF THE REQUEST :
The XMLEncoder currently uses the BeanInfo of a
class to decide whether or not a property should
be considered transient.
The property, as the value of a FeatureDescriptor
has three states Boolean.TRUE, Boolean.FALSE and null.
Currently they each behave as follows:
1. TRUE: Property is transient.
2. FALSE: Same as null.
3. Null: Defer to superclass. If all superclasses
are null, the property is transient iff it
doesn't have both a setter and getter.
I've recently implemented the following and found it
much more useful - and backward compatible:
2. FALSE: Property is not transient.
JUSTIFICATION :
This let's the user fully control the extent to which
the XMLEncoder penetrates an object graph. If, for example,
there were no setContentPane() method in JFrame we would
not be able to use the XMLEncoder to archive JFrame even
though archives rarely (if ever) use the setContentPane()
method. In practice, archives of JFrames work by effectively
calling the getContentPane() method and modifying the resulting
component - which is the conventional programatic idiom too.
If the setContentPane() method did no exist, however, we'd
have no way to archive JFrame's using the XMLEncoder. The
fix above would allow a user to simply override the assumption
that the "contentPane" of a JFrame is transient and make it
non-transient instead.
The setContentPane() does exist in swing's JFrame - but this
is an example - it is very common for settters to be missing
in application classes.
(Incident Review ID: 207872)
======================================================================