Class CodeExecutionToolResultBlockContent
-
- All Implemented Interfaces:
public final class CodeExecutionToolResultBlockContentCode execution result with encrypted stdout for PFC + web_search results.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceCodeExecutionToolResultBlockContent.VisitorAn interface that defines how to map each variant of CodeExecutionToolResultBlockContent to a value of type T.
-
Method Summary
-
-
Method Detail
-
error
final Optional<CodeExecutionToolResultError> error()
-
resultBlock
final Optional<CodeExecutionResultBlock> resultBlock()
-
encryptedCodeExecutionResultBlock
final Optional<EncryptedCodeExecutionResultBlock> encryptedCodeExecutionResultBlock()
Code execution result with encrypted stdout for PFC + web_search results.
-
isResultBlock
final Boolean isResultBlock()
-
isEncryptedCodeExecutionResultBlock
final Boolean isEncryptedCodeExecutionResultBlock()
-
asError
final CodeExecutionToolResultError asError()
-
asResultBlock
final CodeExecutionResultBlock asResultBlock()
-
asEncryptedCodeExecutionResultBlock
final EncryptedCodeExecutionResultBlock asEncryptedCodeExecutionResultBlock()
Code execution result with encrypted stdout for PFC + web_search results.
-
accept
final <T extends Any> T accept(CodeExecutionToolResultBlockContent.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 = codeExecutionToolResultBlockContent.accept(new CodeExecutionToolResultBlockContent.Visitor<Optional<String>>() { @Override public Optional<String> visitError(CodeExecutionToolResultError error) { return Optional.of(error.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final CodeExecutionToolResultBlockContent 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.
-
ofError
final static CodeExecutionToolResultBlockContent ofError(CodeExecutionToolResultError error)
-
ofResultBlock
final static CodeExecutionToolResultBlockContent ofResultBlock(CodeExecutionResultBlock resultBlock)
-
ofEncryptedCodeExecutionResultBlock
final static CodeExecutionToolResultBlockContent ofEncryptedCodeExecutionResultBlock(EncryptedCodeExecutionResultBlock encryptedCodeExecutionResultBlock)
Code execution result with encrypted stdout for PFC + web_search results.
-
-
-
-