Is it possible to deserialize a yaml document with setters that are not void?

330 Views Asked by At

I am working on a project that has a fair amount of data objects that use a "fluent interface" or "method chaining" on their setters so all of the setters in each data object return this. I have looked around and found this question, but it is unclear to me whether this can be used with Yaml as the annotations specifically mention JSON, and also this seems to enable mapping to objects using an actual builder pattern, which is a little different. The project is currently using SnakeYaml, but that can be tossed away if some other lib like Jackson can do this.

1

There are 1 best solutions below

0
Cahlen Brancheau On

It turns out that this is in fact possible. Jackson supports yaml and will work with builder style setters by default without any extra configuration.