Skip to content

Commit 547058c

Browse files
committed
Make most of Builders final
This is a low hanging fruit change to make most of the Builders we have final, according to our recent design choice. A handful of Builders are left non-final because they we involved in a class hierarchy already. Signed-off-by: Eric Bottard <[email protected]>
1 parent 2ded9cd commit 547058c

File tree

72 files changed

+80
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+80
-80
lines changed

advisors/spring-ai-advisors-vector-store/src/main/java/org/springframework/ai/chat/client/advisor/vectorstore/VectorStoreChatMemoryAdvisor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ else if (message instanceof AssistantMessage assistantMessage) {
209209
/**
210210
* Builder for VectorStoreChatMemoryAdvisor.
211211
*/
212-
public static class Builder {
212+
public static final class Builder {
213213

214214
private PromptTemplate systemPromptTemplate = DEFAULT_SYSTEM_PROMPT_TEMPLATE;
215215

mcp/common/src/main/java/org/springframework/ai/mcp/AsyncMcpToolCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static Builder builder() {
160160
/**
161161
* Builder for constructing AsyncMcpToolCallback instances.
162162
*/
163-
public static class Builder {
163+
public static final class Builder {
164164

165165
private McpAsyncClient mcpClient;
166166

mcp/common/src/main/java/org/springframework/ai/mcp/SyncMcpToolCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static Builder builder() {
160160
/**
161161
* Builder for {@code SyncMcpToolCallback} instances.
162162
*/
163-
public static class Builder {
163+
public static final class Builder {
164164

165165
private McpSyncClient mcpClient;
166166

mcp/common/src/main/java/org/springframework/ai/mcp/SyncMcpToolCallbackProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public static Builder builder() {
179179
/**
180180
* Builder for {@code SyncMcpToolCallbackProvider}.
181181
*/
182-
public static class Builder {
182+
public static final class Builder {
183183

184184
private List<McpSyncClient> mcpClients = new ArrayList<>();
185185

models/spring-ai-anthropic/src/main/java/org/springframework/ai/anthropic/AnthropicChatOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public int hashCode() {
307307
this.toolContext, this.httpHeaders, this.cacheOptions);
308308
}
309309

310-
public static class Builder {
310+
public static final class Builder {
311311

312312
private final AnthropicChatOptions options = new AnthropicChatOptions();
313313

models/spring-ai-anthropic/src/main/java/org/springframework/ai/anthropic/api/AnthropicApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ public record PingEvent(
15421542
}
15431543
// @formatter:on
15441544

1545-
public static class Builder {
1545+
public static final class Builder {
15461546

15471547
private String baseUrl = DEFAULT_BASE_URL;
15481548

models/spring-ai-anthropic/src/main/java/org/springframework/ai/anthropic/api/AnthropicCacheOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public String toString() {
112112
+ ", messageTypeMinContentLengths=" + this.messageTypeMinContentLengths + '}';
113113
}
114114

115-
public static class Builder {
115+
public static final class Builder {
116116

117117
private final AnthropicCacheOptions options = new AnthropicCacheOptions();
118118

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiAudioTranscriptionOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public AudioTranscriptionTimestampGranularity getValue() {
255255

256256
}
257257

258-
public static class Builder {
258+
public static final class Builder {
259259

260260
protected AzureOpenAiAudioTranscriptionOptions options;
261261

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiChatOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ public int hashCode() {
573573
this.temperature, this.topP);
574574
}
575575

576-
public static class Builder {
576+
public static final class Builder {
577577

578578
protected AzureOpenAiChatOptions options;
579579

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiEmbeddingOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public com.azure.ai.openai.models.EmbeddingsOptions toAzureOptions(List<String>
116116
return azureOptions;
117117
}
118118

119-
public static class Builder {
119+
public static final class Builder {
120120

121121
private final AzureOpenAiEmbeddingOptions options = new AzureOpenAiEmbeddingOptions();
122122

0 commit comments

Comments
 (0)