-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi,
I'm trying to use a map to save some preferences in JSON format. The map is able to be saved but not able to be read. I don't think this issue is a bug, possibly an enhancement.
e.g.
@ArtifactProviderFor(GriffonModel)
@PreferencesAware
class SampleModel {
@Preference Map myMap
@Preference String myString
}
After setting the model values & calling preferencesManager.save(sampleModel) the default.json is produced as follows:
{"sample": {"SampleModel": {
"myString": "string",
"myMap": {"key": "value2"}
}}}
However when the data is loaded the String value for myMap is processed as a JSONObject so the DefaultPreferencesNode is created as "key"->"value2" instead of "myMap"->(Map)
This appears to all happen in JsonPreferencesPersistor.readInto private method.
In this case could the framework detect that "myMap" property is java.util.Map type and utilize JSonSlurper or some custom converter to convert the string value back to a map?
Cheers,
Paul
Metadata
Metadata
Assignees
Labels
No labels