Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom data relations #176

Open
keremulutas opened this issue Dec 7, 2017 · 2 comments
Open

Custom data relations #176

keremulutas opened this issue Dec 7, 2017 · 2 comments

Comments

@keremulutas
Copy link
Contributor

I don't know if it's feasible or even logical to try doing such a thing, but here is the situation.

Consider generating an Order class with OrderItems - requirements are:

  1. Order instance has a List<OrderItems> orderItems that can have max X items, min Y item
  2. Order instance has a double totalAmount field - as you can guess, this field is equal to the sum of sub-amounts of orderItems members

First step would be added if #175 is implemented.

For the second requirement,

  • totalAmount can be generated first then it could be used to generate orderItems members, or,
  • orderItems could be generated and then totalAmount field could be updated by summing orderItem.amount fields

Can ObjectGeneratorBuilder be extended to include the ability to use generated fields of the about-to-be-generated object? Maybe through using lambdas?

@vajda
Copy link

vajda commented Dec 7, 2017

Thanks @keremulutas , this is really interesting problem and use case is pretty common. I'll try to come up with some idea how to implement this in next week.

@vajda
Copy link

vajda commented Jan 26, 2018

After some thought, we decided to leave this for some next milestone. If you want to do it, pull requests are more than welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants