Add a guarenteeUnique parameter to the builder
- Dominant language
- Java
- Stars
- 6
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Add a method to the builder that allows for people to specify if a value MUST be unique. Build this in 2 different ways: with/without caching.
In the caching model, every time an object is generated, it would had it would check some internal cache to see if that object had been previously created. If the object had been made, it would retry, otherwise it would output and add the new item to the cache. There should be a failure percentage on this in order to prevent infinite loops.
In the non-caching model, an analysis would run to pre-generate an exhaustive list of objects that is then read from in order to populate data.
From the user perspective, this should look something like this
For Caching
```
PojoGeneratorBuilder<>(YourClass.class).guarenteeUnique("field", UniqunessStrategy.cache(60))
```
For non-caching
```
PojoGeneratorBuilder<>(YourClass.class).guarenteeUnique("field", UniqunessStrategy.pregenerated)
```
It will be important for the tooling to make access to the generator storage to be synchornized in order to prevent issues in a multi-threaded environment.
This will require a lot of documentation and warnings about the hazards that come with this on performance.
Contributor guide
Research direction
Start with the PojoGeneratorBuilder API and the proposed UniqunessStrategy examples in the issue; no source files or tests are identified. Completion would require both cached and pregenerated uniqueness modes, synchronized storage, retry or failure behavior, and documentation of performance hazards.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100