Class RawContentBlockDelta
-
- All Implemented Interfaces:
public final class RawContentBlockDelta
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceRawContentBlockDelta.VisitorAn interface that defines how to map each variant of RawContentBlockDelta to a value of type T.
public final classRawContentBlockDelta.Type
-
Method Summary
Modifier and Type Method Description final Optional<TextDelta>text()final Optional<InputJsonDelta>inputJson()final Optional<CitationsDelta>citations()final Optional<ThinkingDelta>thinking()final Optional<SignatureDelta>signature()final Optional<JsonValue>_json()final RawContentBlockDelta.Typetype()final BooleanisText()final BooleanisInputJson()final BooleanisCitations()final BooleanisThinking()final BooleanisSignature()final TextDeltaasText()final InputJsonDeltaasInputJson()final CitationsDeltaasCitations()final ThinkingDeltaasThinking()final SignatureDeltaasSignature()final <T extends Any> Taccept(RawContentBlockDelta.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final RawContentBlockDeltavalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static RawContentBlockDeltaofText(TextDelta text)final static RawContentBlockDeltaofText(String text)Returns an immutable instance of RawContentBlockDelta whose ofText variant is built from the given required text. final static RawContentBlockDeltaofInputJson(InputJsonDelta inputJson)final static RawContentBlockDeltaofInputJson(String partialJson)Returns an immutable instance of RawContentBlockDelta whose ofInputJson variant is built from the given required partialJson. final static RawContentBlockDeltaofCitations(CitationsDelta citations)final static RawContentBlockDeltaofCitations(CitationsDelta.Citation citation)Returns an immutable instance of RawContentBlockDelta whose ofCitations variant is built from the given required citation. final static RawContentBlockDeltaofCitations(CitationCharLocation charLocation)Alias for calling ofCitations with CitationsDelta.Citation.ofCharLocation(charLocation).final static RawContentBlockDeltaofCitations(CitationPageLocation pageLocation)Alias for calling ofCitations with CitationsDelta.Citation.ofPageLocation(pageLocation).final static RawContentBlockDeltaofCitations(CitationContentBlockLocation contentBlockLocation)Alias for calling ofCitations with CitationsDelta.Citation.ofContentBlockLocation(contentBlockLocation).final static RawContentBlockDeltaofCitations(CitationsWebSearchResultLocation webSearchResultLocation)Alias for calling ofCitations with CitationsDelta.Citation.ofWebSearchResultLocation(webSearchResultLocation).final static RawContentBlockDeltaofCitations(CitationsSearchResultLocation searchResultLocation)Alias for calling ofCitations with CitationsDelta.Citation.ofSearchResultLocation(searchResultLocation).final static RawContentBlockDeltaofThinking(ThinkingDelta thinking)final static RawContentBlockDeltaofThinking(String thinking)Returns an immutable instance of RawContentBlockDelta whose ofThinking variant is built from the given required thinking. final static RawContentBlockDeltaofSignature(SignatureDelta signature)final static RawContentBlockDeltaofSignature(String signature)Returns an immutable instance of RawContentBlockDelta whose ofSignature variant is built from the given required signature. -
-
Method Detail
-
inputJson
final Optional<InputJsonDelta> inputJson()
-
citations
final Optional<CitationsDelta> citations()
-
thinking
final Optional<ThinkingDelta> thinking()
-
signature
final Optional<SignatureDelta> signature()
-
type
final RawContentBlockDelta.Type type()
-
isInputJson
final Boolean isInputJson()
-
isCitations
final Boolean isCitations()
-
isThinking
final Boolean isThinking()
-
isSignature
final Boolean isSignature()
-
asInputJson
final InputJsonDelta asInputJson()
-
asCitations
final CitationsDelta asCitations()
-
asThinking
final ThinkingDelta asThinking()
-
asSignature
final SignatureDelta asSignature()
-
accept
final <T extends Any> T accept(RawContentBlockDelta.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 = rawContentBlockDelta.accept(new RawContentBlockDelta.Visitor<Optional<String>>() { @Override public Optional<String> visitText(TextDelta text) { return Optional.of(text.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final RawContentBlockDelta 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.
-
ofText
final static RawContentBlockDelta ofText(TextDelta text)
-
ofText
final static RawContentBlockDelta ofText(String text)
Returns an immutable instance of RawContentBlockDelta whose ofText variant is built from the given required text.
-
ofInputJson
final static RawContentBlockDelta ofInputJson(InputJsonDelta inputJson)
-
ofInputJson
final static RawContentBlockDelta ofInputJson(String partialJson)
Returns an immutable instance of RawContentBlockDelta whose ofInputJson variant is built from the given required partialJson.
-
ofCitations
final static RawContentBlockDelta ofCitations(CitationsDelta citations)
-
ofCitations
final static RawContentBlockDelta ofCitations(CitationsDelta.Citation citation)
Returns an immutable instance of RawContentBlockDelta whose ofCitations variant is built from the given required citation.
-
ofCitations
final static RawContentBlockDelta ofCitations(CitationCharLocation charLocation)
Alias for calling ofCitations with
CitationsDelta.Citation.ofCharLocation(charLocation).
-
ofCitations
final static RawContentBlockDelta ofCitations(CitationPageLocation pageLocation)
Alias for calling ofCitations with
CitationsDelta.Citation.ofPageLocation(pageLocation).
-
ofCitations
final static RawContentBlockDelta ofCitations(CitationContentBlockLocation contentBlockLocation)
Alias for calling ofCitations with
CitationsDelta.Citation.ofContentBlockLocation(contentBlockLocation).
-
ofCitations
final static RawContentBlockDelta ofCitations(CitationsWebSearchResultLocation webSearchResultLocation)
Alias for calling ofCitations with
CitationsDelta.Citation.ofWebSearchResultLocation(webSearchResultLocation).
-
ofCitations
final static RawContentBlockDelta ofCitations(CitationsSearchResultLocation searchResultLocation)
Alias for calling ofCitations with
CitationsDelta.Citation.ofSearchResultLocation(searchResultLocation).
-
ofThinking
final static RawContentBlockDelta ofThinking(ThinkingDelta thinking)
-
ofThinking
final static RawContentBlockDelta ofThinking(String thinking)
Returns an immutable instance of RawContentBlockDelta whose ofThinking variant is built from the given required thinking.
-
ofSignature
final static RawContentBlockDelta ofSignature(SignatureDelta signature)
-
ofSignature
final static RawContentBlockDelta ofSignature(String signature)
Returns an immutable instance of RawContentBlockDelta whose ofSignature variant is built from the given required signature.
-
-
-
-