EsotericSoftware / EsotericSoftware/yamlbeans

Skipping One Side of Bidrectional Links / Collection Handling

Open
#2 4 comments 0 reactions 0 assignees View on GitHub
bug imported Priority-Medium
Dominant language
Java
Stars
568
Forks
146
PR merge metrics
No merged PRs in 30d

Description

_From [m...@ivu.de](https://code.google.com/u/100281746364845522337/) on March 30, 2010 09:35:59_

I intend to use YamlBeans to automate data provisioning for integration
tests. The objects to be (de-)serialized are normally retrieved from a
database and often have bidirectional links:

Parent:
- Collection children
- void addToChildren(child)

Child:
- Parent parent

Since fixing the serialization of cyclic references this structure can be
serialized however it is heavily anchored without any real need.

Secondly, current deserialization code assumes that collections can be just
created, added to and assigned to the object being deserialized. In my case
collections are normally read-only and can be only worked on using specific
addTo_, removeFrom_ methods (also making it easier to track changes).

The attached patch does two things:
- Introduce a writeConfig parameter to skip immediate collection
backreferences
- Introduce pluggable handlers for collection deserialization
(CollectionDeserializer)

It also includes new unit tests for the mentioned use cases...

**Attachment:** [backreferences-collections.patch](http://code.google.com/p/yamlbeans/issues/detail?id=2)

_Original issue: http://code.google.com/p/yamlbeans/issues/detail?id=2_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.