Skip to content

Add Java Record support in JavaObjectTransformer #824

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

Merged

Conversation

panilya
Copy link
Collaborator

@panilya panilya commented May 7, 2023

At the moment, Datafaker doesn't support Java Records. This PR addresses this problem

@panilya panilya force-pushed the support-record-java-object-trans branch from ced7c51 to 3492a6e Compare May 7, 2023 11:43
@bodiam bodiam requested a review from snuyanzin May 7, 2023 12:30
}

try {
result = clazz.getDeclaredConstructor(componentTypes).newInstance(values);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to cache it as well to avoid constant calculation logic

Copy link
Collaborator Author

@panilya panilya May 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's possible to cache object, but I can cache constructor. WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, constructor should be enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snuyanzin I have a question for you, imagine an article about Datafaker 2.0, what would you expect to see in that article, I mean topics or something like this

Copy link
Collaborator

@snuyanzin snuyanzin May 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depends on the target audience...

there is a list of topics missed in faker related talks

  1. custom providers
  2. there are ways to generate sequences (stream and sequence)
  3. the transformation approach (csv, json, sql, java, custom)
  4. object population as a replacement for builders
  5. now datafaker is fast enough to generate big test data

Copy link
Collaborator Author

@panilya panilya May 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I send you my draft of the article about Datafaker 2.0? I would like to hear your opinion if you don't mind and if you have time, of course

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, sure

@panilya panilya merged commit 6ee0732 into datafaker-net:main May 7, 2023
@panilya panilya deleted the support-record-java-object-trans branch May 7, 2023 16:42
@bodiam
Copy link
Contributor

bodiam commented May 7, 2023

Nice feature Illia, amazing work!

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

Successfully merging this pull request may close these issues.

3 participants