添加自定义代码
添加自定义代码
添加自定义代码
本页面介绍如何向您的 Java SDK 添加自定义逻辑、方法和依赖项。
开始添加自定义代码:
Fern also allows you to add custom methods to the SDK itself (e.g.
client.my_method() ) by inheriting the Fern generated client and then
extending it.
Java SDK 生成器通过可选的自类型模式支持构建器扩展性。当通过 enable-extensible-builders 标志启用时,生成的构建器可以被扩展,同时在方法链接过程中保持类型安全。
常见用例包括:
https://api.${TENANT}.example.com)如果您不需要扩展构建器,请使用提供的 Impl 类:
每个方法都有特定的目的,仅在需要时生成:
generators.yml 中设置 enable-extensible-builders: true此功能仅适用于企业计划。如需开始使用,请联系 support@buildwithfern.com。
要添加您的自定义代码所需的包,请更新您的 generators.yml。