Class StreamEvent.Data
-
- All Implemented Interfaces:
public final class StreamEvent.Data
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceStreamEvent.Data.VisitorAn interface that defines how to map each variant of Data to a value of type T.
public final classStreamEvent.Data.StreamEventSystemDataOutputpublic final classStreamEvent.Data.StreamEventLogDataOutput
-
Method Summary
-
-
Method Detail
-
streamEventSystemDataOutput
final Optional<StreamEvent.Data.StreamEventSystemDataOutput> streamEventSystemDataOutput()
-
streamEventLogDataOutput
final Optional<StreamEvent.Data.StreamEventLogDataOutput> streamEventLogDataOutput()
-
isStreamEventSystemDataOutput
final Boolean isStreamEventSystemDataOutput()
-
isStreamEventLogDataOutput
final Boolean isStreamEventLogDataOutput()
-
asStreamEventSystemDataOutput
final StreamEvent.Data.StreamEventSystemDataOutput asStreamEventSystemDataOutput()
-
asStreamEventLogDataOutput
final StreamEvent.Data.StreamEventLogDataOutput asStreamEventLogDataOutput()
-
accept
final <T extends Any> T accept(StreamEvent.Data.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.browserbase.api.core.JsonValue; import java.util.Optional; Optional<String> result = data.accept(new Data.Visitor<Optional<String>>() { @Override public Optional<String> visitStreamEventSystemDataOutput(StreamEventSystemDataOutput streamEventSystemDataOutput) { return Optional.of(streamEventSystemDataOutput.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final StreamEvent.Data 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.
-
ofStreamEventSystemDataOutput
final static StreamEvent.Data ofStreamEventSystemDataOutput(StreamEvent.Data.StreamEventSystemDataOutput streamEventSystemDataOutput)
-
ofStreamEventLogDataOutput
final static StreamEvent.Data ofStreamEventLogDataOutput(StreamEvent.Data.StreamEventLogDataOutput streamEventLogDataOutput)
-
-
-
-