Class McpCompleteCompletion.Builder
- Enclosing class:
- McpCompleteCompletion
McpCompleteCompletion instances.
This builder provides a fluent API for creating completion results with defensive copying to protect against external modification of mutable inputs. The builder maintains the same immutability guarantees as the record itself.
- Author:
- codeboyzhou
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newMcpCompleteCompletioninstance with the configured values.hasMore(boolean hasMore) Sets whether more completions are available.Sets the total number of available completions.Sets the completion values with defensive copying.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
values
Sets the completion values with defensive copying.This method creates an immutable copy of the input list to prevent external modification after the value has been set. If the input list is null, the internal values field is set to null.
- Parameters:
values- the list of completion values to set, may be null- Returns:
- this
McpCompleteCompletion.Builderinstance for method chaining
-
total
Sets the total number of available completions.This value represents the total count of completions that could be returned, which may be greater than the number of values in the current completion result if pagination is supported.
- Parameters:
total- the total number of available completions, may be null- Returns:
- this
McpCompleteCompletion.Builderinstance for method chaining
-
hasMore
Sets whether more completions are available.This flag indicates whether additional completion results can be obtained through further requests, typically used for pagination or incremental loading scenarios.
- Parameters:
hasMore- true if more completions are available, false otherwise- Returns:
- this
McpCompleteCompletion.Builderinstance for method chaining
-
build
Builds a newMcpCompleteCompletioninstance with the configured values.This method creates a new record instance using the current builder state. The record's compact constructor will apply additional defensive copying to ensure the final object is fully immutable.
- Returns:
- a new
McpCompleteCompletioninstance with the configured values
-