Package com.anthropic.models.messages
Class ToolsetToolUseBlock
-
- All Implemented Interfaces:
public final class ToolsetToolUseBlock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceToolsetToolUseBlock.VisitorAn interface that defines how to map each variant of ToolsetToolUseBlock to a value of type T.
-
Method Summary
-
-
Method Detail
-
browser
final Optional<BrowserToolUseBlock> browser()
-
computer
final Optional<ComputerToolUseBlock> computer()
-
toolUseBlock
final Optional<ToolUseBlock> toolUseBlock()
-
isComputer
final Boolean isComputer()
-
isToolUseBlock
final Boolean isToolUseBlock()
-
asBrowser
final BrowserToolUseBlock asBrowser()
-
asComputer
final ComputerToolUseBlock asComputer()
-
asToolUseBlock
final ToolUseBlock asToolUseBlock()
-
accept
final <T extends Any> T accept(ToolsetToolUseBlock.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 = toolsetToolUseBlock.accept(new ToolsetToolUseBlock.Visitor<Optional<String>>() { @Override public Optional<String> visitBrowser(BrowserToolUseBlock browser) { return Optional.of(browser.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ToolsetToolUseBlock 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.
-
ofBrowser
final static ToolsetToolUseBlock ofBrowser(BrowserToolUseBlock browser)
-
ofComputer
final static ToolsetToolUseBlock ofComputer(ComputerToolUseBlock computer)
-
ofToolUseBlock
final static ToolsetToolUseBlock ofToolUseBlock(ToolUseBlock toolUseBlock)
-
-
-
-