I have the next problem: at the start of the project I had only one implementation of some class:
class Wrapper {
private Child child;
}
class Child { ... }
and when mongodb serializes this class it never set _class attribute for the child object.
Now I need to make the next classes structure:
class Wrapper {
private Child child;
}
abstract class Child { ... }
class ChildA extends Child { ... }
class ChildB extends Child { ... }
Obviously, then I try to deserialize old documents, it throws an exception because it can't instantiate an abstract class.
The question is: is it any way to specify the default implementation for object deserialization? For example, I want to deserialize the child field into the Child1 class if the _class attribute is not present like this parameter in Jackson library?