Enum Class ToolDefer
- All Implemented Interfaces:
Serializable, Comparable<ToolDefer>, Constable
ToolDefinition may be deferred (loaded lazily via
tool search) rather than always pre-loaded.
Set on
ToolDefinition.createWithDefer(String, String, java.util.Map, ToolHandler, ToolDefer)
to express the tool's deferral preference; defaults to letting the runtime
decide when unset.
- Since:
- 1.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolDeferDeserializes a JSON string value into the correspondingToolDeferenum constant.getValue()Returns the JSON value for this deferral mode.static ToolDeferReturns the enum constant of this class with the specified name.static ToolDefer[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
No deferral preference set. This is an annotation-only sentinel used as the default for@CopilotTool(defer = ToolDefer.NONE).This constant must not be passed to
ToolDefinitionfactory methods. The annotation processor andToolDefinition.fromObject()must mapNONEto anullfield reference so that@JsonInclude(NON_NULL)onToolDefinitionomits thedeferkey from the JSON-RPC wire payload entirely (matching the nullable/optional semantics used by all other SDKs).As a secondary safety net,
getValue()returnsnullfor this constant. Note that this alone does not cause field omission: if a non-nullNONEreference reaches aToolDefinitionfield, Jackson's@JsonInclude(NON_NULL)will still emit the field (as"defer": null) because the field reference itself is not null. The primary protection is mappingNONEto a null field reference before constructing theToolDefinition. -
AUTO
The tool can be deferred and surfaced through tool search. -
NEVER
The tool is always pre-loaded.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getValue
Returns the JSON value for this deferral mode.Returns
nullforNONEto avoid emitting an empty string ("defer": "") if this sentinel accidentally reaches serialization. Withnull, the worst-case leak becomes"defer": nullrather than an invalid empty string.- Returns:
- the string value used in JSON serialization, or
nullforNONE
-
fromValue
Deserializes a JSON string value into the correspondingToolDeferenum constant.- Parameters:
value- the JSON string value- Returns:
- the matching
ToolDefer, ornullif value isnull - Throws:
IllegalArgumentException- if the value does not match any known deferral mode
-