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

Postpone initialization of FakerConfig through the Builder #88

Closed
serpro69 opened this issue Jun 9, 2021 · 0 comments
Closed

Postpone initialization of FakerConfig through the Builder #88

serpro69 opened this issue Jun 9, 2021 · 0 comments
Labels
core 🧬 Issue related to :core module enhancement 🚀 New feature or request good first issue 🔰 Good for newcomers

Comments

@serpro69
Copy link
Owner

serpro69 commented Jun 9, 2021

val configBuilder = FakerConfig.Builder()
    .setLocale("nl")
    .setUniqueGeneratorRetryLimit(111)

configBuilder.setRandomSeed(42)

val config: FakerConfig = configBuilder.build()

val faker = Faker(config)

The above is currently not supported because:

  • FakerConfig.Builder has internally-visible constructor
  • setter functions need to be added that return an instance of Builder

Motivation:

  • There could be situations where one might want to postpone building the config instance, this is not possible with the fakerConfig function that builds the FakerConfig instance automatically.
  • This is a more natural way to do builders in java (Lambdas in java are also quite ugly.) and could be preferable to usage of fakerConfig function.
@serpro69 serpro69 added core 🧬 Issue related to :core module enhancement 🚀 New feature or request good first issue 🔰 Good for newcomers labels Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core 🧬 Issue related to :core module enhancement 🚀 New feature or request good first issue 🔰 Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant