[MAGNOLIA-6693] Introduce proxy-based mutable wrapper utility as alternative to Cloner functionality Created: 14/Jun/16 Updated: 09/Feb/17 Resolved: 27/Jun/16 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | 5.4.7 |
| Fix Version/s: | 5.4.8, 5.5 |
| Type: | New Feature | Priority: | Neutral |
| Reporter: | Aleksandr Pchelintcev | Assignee: | Aleksandr Pchelintcev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 6d | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||
| Sprint: | Basel 50, Basel 50 | ||||||||||||||||||||||||||||
| Story Points: | 8 | ||||||||||||||||||||||||||||
| Description |
|
Some use cases require a custom mutable definition to be created from the code to achieve some dynamic functionality (e.g. choose/move dialogs and some other features in UI). Usually such definitions are derived from the existing definitions via cloning in order to prevent modification of the source definition (which is a singleton). So far we've been using the deep cloning approach provided by com.rits.cloning.Cloner utility. However, there were numerous problems with cloning the definition objects that aren't merest POJO under the hood. Especially big pain is caused by the proxied objects (e.g. i18n'ized definitions, decorated definitions etc) since internally such objects normally have cross-references (e.g. CGLIB tooling fields) which cause cycle dependencies and stack overflow exceptions during cloning. I propose to cure the problem in 'homeopathic' way - create a utility that would allow generate a mutable proxy wrapper object:
The wrap call could look like this: This way we gain the following:
|