Class ToolUseBlockParam.Caller
-
- All Implemented Interfaces:
public final class ToolUseBlockParam.CallerTool invocation directly from the model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceToolUseBlockParam.Caller.VisitorAn interface that defines how to map each variant of Caller to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<DirectCaller>direct()Tool invocation directly from the model. final Optional<ServerToolCaller>codeExecution20250825()Tool invocation generated by a server-side tool. final Optional<ServerToolCaller20260120>codeExecution20260120()final BooleanisDirect()final BooleanisCodeExecution20250825()final BooleanisCodeExecution20260120()final DirectCallerasDirect()Tool invocation directly from the model. final ServerToolCallerasCodeExecution20250825()Tool invocation generated by a server-side tool. final ServerToolCaller20260120asCodeExecution20260120()final Optional<JsonValue>_json()final <T extends Any> Taccept(ToolUseBlockParam.Caller.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ToolUseBlockParam.Callervalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ToolUseBlockParam.CallerofDirect(DirectCaller direct)Tool invocation directly from the model. final static ToolUseBlockParam.CallerofCodeExecution20250825(ServerToolCaller codeExecution20250825)Tool invocation generated by a server-side tool. final static ToolUseBlockParam.CallerofCodeExecution20260120(ServerToolCaller20260120 codeExecution20260120)-
-
Method Detail
-
direct
final Optional<DirectCaller> direct()
Tool invocation directly from the model.
-
codeExecution20250825
final Optional<ServerToolCaller> codeExecution20250825()
Tool invocation generated by a server-side tool.
-
codeExecution20260120
final Optional<ServerToolCaller20260120> codeExecution20260120()
-
isCodeExecution20250825
final Boolean isCodeExecution20250825()
-
isCodeExecution20260120
final Boolean isCodeExecution20260120()
-
asDirect
final DirectCaller asDirect()
Tool invocation directly from the model.
-
asCodeExecution20250825
final ServerToolCaller asCodeExecution20250825()
Tool invocation generated by a server-side tool.
-
asCodeExecution20260120
final ServerToolCaller20260120 asCodeExecution20260120()
-
accept
final <T extends Any> T accept(ToolUseBlockParam.Caller.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = caller.accept(new Caller.Visitor<Optional<String>>() { @Override public Optional<String> visitDirect(DirectCaller direct) { return Optional.of(direct.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ToolUseBlockParam.Caller validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofDirect
final static ToolUseBlockParam.Caller ofDirect(DirectCaller direct)
Tool invocation directly from the model.
-
ofCodeExecution20250825
final static ToolUseBlockParam.Caller ofCodeExecution20250825(ServerToolCaller codeExecution20250825)
Tool invocation generated by a server-side tool.
-
ofCodeExecution20260120
final static ToolUseBlockParam.Caller ofCodeExecution20260120(ServerToolCaller20260120 codeExecution20260120)
-
-
-
-