Record Class McpCompleteCompletion
- Record Components:
values- the list of completion values, may be nulltotal- the total number of available completions, may be nullhasMore- true if more completions are available, false otherwise
This record encapsulates the response data for completion requests, including the list of completion values, total count, and whether more results are available. The class is designed to be immutable and provides defensive copying to protect internal state from external modification.
- Author:
- codeboyzhou
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructingMcpCompleteCompletioninstances. -
Constructor Summary
ConstructorsConstructorDescriptionMcpCompleteCompletion(List<String> values, Integer total, boolean hasMore) Compact constructor that creates a defensive copy of the values list. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a newMcpCompleteCompletion.Builderinstance for constructingMcpCompleteCompletionobjects.static McpCompleteCompletionempty()Creates an emptyMcpCompleteCompletioninstance.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhasMore()Returns the value of thehasMorerecord component.final StringtoString()Returns a string representation of this record class.total()Returns the value of thetotalrecord component.values()Returns the value of thevaluesrecord component.
-
Constructor Details
-
McpCompleteCompletion
Compact constructor that creates a defensive copy of the values list.This constructor ensures that the internal list cannot be modified from outside the record by creating an immutable copy using
List.copyOf(Collection). If the input list is null, it remains null to preserve the original intent.- Parameters:
values- the input list of completion values to be defensively copiedtotal- the total number of available completions, may be nullhasMore- true if more completions are available, false otherwise
-
-
Method Details
-
builder
Creates a newMcpCompleteCompletion.Builderinstance for constructingMcpCompleteCompletionobjects.This factory method provides a convenient way to create a builder for step-by-step construction of completion results using the builder pattern.
- Returns:
- a new
McpCompleteCompletion.Builderinstance
-
empty
Creates an emptyMcpCompleteCompletioninstance.This factory method returns a completion result with no values, zero total count, and no more results available. Useful as a default or placeholder completion.
- Returns:
- an empty
McpCompleteCompletioninstance
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
values
Returns the value of thevaluesrecord component.- Returns:
- the value of the
valuesrecord component
-
total
Returns the value of thetotalrecord component.- Returns:
- the value of the
totalrecord component
-
hasMore
public boolean hasMore()Returns the value of thehasMorerecord component.- Returns:
- the value of the
hasMorerecord component
-