-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add builder api #3
Comments
What would be the return value of build()? The example suggests that the Builder should be part of the JsonHomeClient object. So my guess for the type of the return value would be JsonHomeClient. |
According to issue #1 I'd rename JsonHomeService to JsonHomeClient, and perhaps just get rid of what's right now JsonHomeClient. |
Adds a typesafe builder pattern to enable the user to write code like this: JsonHomeService.Builder() .addHost("http://host", DirectLinkRelationType("rel"), TemplateLinkRelationType("rel2")) .addHost("https://host2", DirectLinkRelationType("rel3")) .withWSClient(WS.client) .withCaching(system) .withUpdateInterval(1.minute) .withStartDelay(2.minutes) .build() The implementation uses phantom types and implicit conversions to ensure that all necessary parameters are passed to the builder before build() can be called.
It would be nice to have a builder like this:
The text was updated successfully, but these errors were encountered: