Skip to content

Conversation

@tstanmay13
Copy link
Contributor

Java code was updated here to have a new format fern-api/fern#8587. Update the docs to reflect these changes.

@tstanmay13 tstanmay13 requested a review from devalog August 5, 2025 21:56
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025


### Default implementation

If you don't need to extend the builder, use the provided `Impl` class:
Copy link
Collaborator

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.

Copy link
Contributor Author

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`
Copy link
Collaborator

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!

Copy link
Contributor Author

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.
Copy link
Collaborator

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!)

Copy link
Contributor Author

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.

@tstanmay13 tstanmay13 merged commit bf3adf5 into main Aug 6, 2025
1 check passed
@tstanmay13 tstanmay13 deleted the java/update-java-custom-code branch August 6, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants