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

Allow to use Supplier from java8 and guava as Randomizer #28

Closed
Toilal opened this issue Jul 31, 2015 · 6 comments
Closed

Allow to use Supplier from java8 and guava as Randomizer #28

Toilal opened this issue Jul 31, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@Toilal
Copy link
Contributor

Toilal commented Jul 31, 2015

Create a new PopulatorBuilder method supporting Supplier instead of Randomizer.

class PopulatorBuilder8 extends PopulatorBuilder {
    public PopulatorBuilder registerRandomizer(final Class type, final Class fieldType, final String fieldName, final Supplier<?> randomizer) {
        return super.registerRandomizer(type, fieldType, fieldName, Java8Adapters.adapt(randomizer)):
    }
}

Same idea for guava Supplier.

It requires #26 to keep support of java version. (jpopulator-java8 and jpopulator-guava modules)

@fmbenhassine
Copy link
Member

Indeed, great idea 👍 Thank you Rémi!

Let's plan that for next release 😃

@fmbenhassine fmbenhassine added this to the 1.3 milestone Aug 2, 2015
@fmbenhassine fmbenhassine self-assigned this Aug 2, 2015
@fmbenhassine
Copy link
Member

I was trying to add support for Supplier in the Builder but this would make the library require Java 8 as minimum Java version (while some people are still using Java 6, example in #43 ) .

I was not able to use java source level to 1.8 and target level to 1.6 (because only random-beans-java8 module requires Java 8). So I need to pay attention to not use Java 8 APIs outside this module..

As of today, the library is compiled with Java 8 but the binary is still Java 6 compatible.

@fmbenhassine fmbenhassine modified the milestones: 3.0.0, 2.0.0 Jan 24, 2016
PascalSchumacher added a commit to PascalSchumacher/easy-random that referenced this issue Mar 31, 2016
PascalSchumacher added a commit to PascalSchumacher/easy-random that referenced this issue Apr 1, 2016
PascalSchumacher added a commit to PascalSchumacher/easy-random that referenced this issue Apr 1, 2016
@PascalSchumacher
Copy link
Collaborator

pull request which adds the feature to use a java8 supplier: #96

@fmbenhassine
Copy link
Member

Hi @Toilal

I've added support to use Java 8 suppliers as randomizers.

It would be great to give it a try if possible to see if it corresponds to what you have requested.
Many thanks upfront.

Kind regards
Mahmoud

@Toilal
Copy link
Contributor Author

Toilal commented Apr 3, 2016

I think it's good thanks ! I'll effectively try later.

@fmbenhassine
Copy link
Member

Hi Rémi,

No problem, take your time.

This will be released soon in v3.0.0
In case of any issue please file a bug.

Note that support for the standard Java 8 API Supplier has been added. Support for guava API will not be included since it is specific.

Kind regards
Mahmoud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants