Replies: 1 comment 1 reply
-
If I understood correctly, the item ID value depends on the parent ID value. You should be able to achieve this using the Supplier<String> someGeneratedValue = () -> Gen.string().prefix("CHILD_ID_").get();
List<TestObject> list = Instancio.ofList(TestObject.class)
.size(10)
.assign(Assign.valueOf(TestObject::getId)
.to(TestObjectItem::getId)
.as(parentId -> parentId + "_" + someGeneratedValue.get()))
.create(); Sample output:
Please see https://www.instancio.org/user-guide/#using-assign for details. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sometimes we need consistency of data, some requirements of business logic.
For example
I wrote some code.
From InstancioEngine to the CallbackHandler I send some useful values.
And as the result callback invoke looks like this:
}
It’s just a scratch, maybe we can discus, right approach for this functionality?
And then I contribute may pull request.
Beta Was this translation helpful? Give feedback.
All reactions