Skip to content

Add Java Record support in JavaObjectTransformer#824

Merged
panilya merged 3 commits into
datafaker-net:mainfrom
panilya:support-record-java-object-trans
May 7, 2023
Merged

Add Java Record support in JavaObjectTransformer#824
panilya merged 3 commits into
datafaker-net:mainfrom
panilya:support-record-java-object-trans

Conversation

@panilya

@panilya panilya commented May 7, 2023

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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

@panilya panilya May 7, 2023

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
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
Copy Markdown
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

@snuyanzin snuyanzin May 7, 2023

Copy link
Copy Markdown
Collaborator

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

@panilya panilya May 7, 2023

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
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

bodiam commented May 7, 2023

Copy link
Copy Markdown
Contributor

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