-
Notifications
You must be signed in to change notification settings - Fork 3
update Java custom code with new self() implemenation #362
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
Conversation
|
|
||
| ### Default implementation | ||
|
|
||
| If you don't need to extend the builder, use the provided `Impl` class: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it'd be pretty clear to someone when they would or wouldn't need to extend the builder? If not, you could add another sentence describing a typical use case for someone who doesn't need to extend the builder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I think so actually! If they want base client options (most customers just rely on the one that is generated) it would make sense.
|
|
||
| - **Fern Java SDK version**: 2.39.1 or later | ||
| - **Fern Java SDK version**: 2.39.6 or later | ||
| - **Configuration**: `enable-extensible-builders: true` in `generators.yml` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be great if you could add a new entry with a brief description in the Java Configuration page for enable-extensible-builders!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
| ## Adding custom client configuration | ||
|
|
||
| The Java SDK generator supports builder extensibility through a template method pattern. By extending the generated builder classes and overriding protected methods, you can customize how your SDK client is configured without modifying generated code. | ||
| The Java SDK generator supports builder extensibility through an opt-in self-type pattern. When enabled via the `enable-extensible-builders` flag, generated builders can be extended while maintaining type safety during method chaining. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think most people reading this page would understand what "self-type pattern" means? I'd consider wording this differently if not. (Feel free to ignore this if you think it's clear the way it is, I'm no Java expert!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so! If the users are comfortable with Java they should know what this provides.
Java code was updated here to have a new format fern-api/fern#8587. Update the docs to reflect these changes.