I need to deserialize a yml
file into a Java object which does not have a default constructor. This causes Jackson's ObjectMapper to complain and throw an exception.
The Java class in particular is not my own (it's a dependency), so I cannot modify it. The author's idea for the class is to construct objects using the Builder Pattern and has not provided a default constructor.
In order to circumvent the issue I would need to create an adapter class, I suppose. Then I would build my object by using the serialized adapter object and filling in the builder.
Is there any cleaner way to do this? If only ObjectMapper provided methods to read from a stream into a specific object, I could make an empty object using the builder and then fill it up with Jackson...