Hi all,
I already asked a similar question here and was encouraged to not use the .cproject/XmlStorage mechanism for new code.
I need to persist lists of integral values (int, boolean, String) and, if feasible, to persist (String-)key-value pairs, all of these in an SCM-friendly way. The RCP and eclipse APIs as well as the java property-file API do not allow to store lists.
Basically I want sth. that does the same as Java serialization does for *Java beans*, but stores the data as text files.
Some options I evaluated in this field:
- XML: (quite a bit of the 90ties, but anyway
-- The CDT .cproject/XmlStorage mechanism. It looks like an attemp to persist properties coming in from multiple plugins in a singel file. Tedious and error-prone.
-- I looked at apache xmlbeans and found it seems to be more a XML-schema-to-java-classes generator. At my short glance, it seems to require an xml schema definiton to start from.
-- x-stream [1]. Jenkins uses it to (de-)serialize configuration classes. OOTB it uses *field names* as XML tags which will make persisted data un-readable if a field gets renamed. But it comes with a JavaBeanConverter [2] which might help to write *JavaBean property names* to XML instead of field names to avoid breaking persisted data when fields are renamed.
- YAML:
-- snakeyaml is in eclipse orbit (as v 1.14; current version is 1.27).
I would prefer to use snakeyaml since it can persist JavaBean objects which is much easier to code than access to property maps.
Does anyone object if I would add snakeyaml to the current target platform and use it?
Regards,
Martin
[1]
https://x-stream.github.io/[2]
https://x-stream.github.io/javadoc/com/thoughtworks/xstream/converters/javabean/JavaBeanConverter.html