'ObjectGraphBuilder select specific subclass for a property
I have the following class hierarchy:
class Tree {
Branch branch;
}
abstract class Branch {
int length;
}
class SubBranch1 extends Branch {}
class SubBranch2 extends Branch {}
I'm trying to use ObjectGraphBuilder to instantiate a Tree as follows:
builder.Tree {
branch(length: 3)
}
How do I tell ObjectGraphBuilder which Branch subclass to use?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
