Skip to content

Getting The Context of Generated Instance #1203

Answered by armandino
MafSholl asked this question in Q&A
Discussion options

You must be logged in to vote

You can assign the generated value of one field to another field using the assign() method:

List<Airport> airports = Instancio.ofList(Airport.class)
        //...snip
        .assign(Assign.valueOf(field(Airport::getCode)).to(field(Airport::getCountry)))
        .create();

Please see the docs for more examples: https://www.instancio.org/user-guide/#using-assign

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MafSholl
Comment options

Answer selected by MafSholl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants