History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-470
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Joerg Schaible
Reporter: J. Matthew Pryor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

allow transient fields to be optionally deserialized

Created: 24/Jan/08 06:22 AM   Updated: 25/Feb/08 05:02 PM
Component/s: Converters
Affects Version/s: None
Fix Version/s: 1.3


 Description  « Hide
It would be nice to be able to optionally allow transient fields to be deserialized. We'd like to use this as part of a deprecation/data migrations strategy.

If AbstractReflectionConverter had a method like:

protected boolean shouldDeserializeTransientField(){
    return false
};

Then those of us who want this can trivially over-ride that in a customer ReflectionConverter

There are 2 places in AbstractReflectionConverter where the following code appears :

if (Modifier.isTransient(field.getModifiers()) {
    reader.moveUp();
    continue;
}

It could be easily modified to be

if (Modifier.isTransient(field.getModifiers() && !shouldDeserializeTransientField) {
    reader.moveUp();
    continue;
}

In this way, people could access this functionality with a trivial subclass of ReflectionConverter without any impact on current users or functionality.

Probably the "correct" way to do it is to put the query method in to the Mapper interface, but this would have more change/impact

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Joerg Schaible - 22/Feb/08 06:12 PM
Implemented as proposed. See head revision.

Joerg Schaible - 25/Feb/08 05:02 PM
Closing issues before next release.