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

Support stream generation with JavaObjectTransformer #1313

Merged
merged 5 commits into from
Aug 8, 2024

Conversation

gatear
Copy link
Contributor

@gatear gatear commented Jul 24, 2024

In order to make JavaObjectTransformer generate a stream of values through method

    public Stream<Object> generateStream(final Schema<Object, ?> schema, long limit)

I had to inject a clazz variable sourceClazz.
sourceClazz acts as the input Class for apply.

Copy link

what-the-diff bot commented Jul 24, 2024

PR Summary

  • Introduction of Optional Types
    The use of the Optional type has been introduced in the JavaObjectTransformer class. This is important as the Optional type helps us avoid NullPointerExceptions making our code safer and more robust by telling us where we could expect to see nulls.

  • Creation of a New Field
    A new field sourceClazz was created. It helps to hold an object that we may or may not possess and its usage will make it easier for other developers to understand what the field is doing within our codebase.

  • Introduction of New method
    A new method from(Class input) was added which allows developers to easily convert input data into the type we want. This makes the usage of the JavaObjectTransformer class easier and more diverse.

  • Modification of Existing methods
    Modifications were done to the generateStream and generate methods in JavaObjectTransformer class. The usage of the generateStream method now returns a stream of data which can be processed easily and efficiently. Furthermore, using sourceClazz in these methods gives us added flexibility in deciding which class we're working with, hence improving functionality.

  • Addition and Expansion of Tests
    Two new test cases were added to JavaObjectTransformerTest.java. These ensure the smooth running of our code, able to properly check the correct functioning of our generateStream method in both scenarios where the source class is populated and when it's empty. The inclusion of these tests will maintain the stability and reliability of our application.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.89%. Comparing base (9cfcfdf) to head (72360fc).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1313      +/-   ##
============================================
+ Coverage     91.82%   91.89%   +0.07%     
- Complexity     3096     3102       +6     
============================================
  Files           311      311              
  Lines          6090     6098       +8     
  Branches        631      631              
============================================
+ Hits           5592     5604      +12     
+ Misses          342      339       -3     
+ Partials        156      155       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bodiam
Copy link
Contributor

bodiam commented Aug 6, 2024

Hi @gatear , what's the state of this PR? It looks good to me, do you want it merged?

@gatear
Copy link
Contributor Author

gatear commented Aug 6, 2024

@bodiam yes, it's ready to merge 👍

@bodiam bodiam merged commit 9107dbd into datafaker-net:main Aug 8, 2024
12 checks passed
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.

2 participants