Interface StreamResponseMapper

All Known Implementing Classes:
StreamResponseMapperImpl

public interface StreamResponseMapper
Mapper between StreamingEventKind and StreamResponse.

StreamResponse uses a protobuf oneof field to represent polymorphic streaming events. StreamingEventKind is a sealed interface with four permitted implementations:

This mapper provides bidirectional conversion using instanceof checks (toProto) and switch expressions on the oneof case (fromProto).

  • Field Details

  • Method Details

    • toProto

      default StreamResponse toProto(StreamingEventKind domain)
      Converts domain StreamingEventKind to proto StreamResponse. Uses instanceof checks to determine which oneof field to set.
      Parameters:
      domain - the streaming event kind (Task, Message, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent)
      Returns:
      the proto StreamResponse with the appropriate oneof field set
    • fromProto

      default StreamingEventKind fromProto(StreamResponse proto)
      Converts proto StreamResponse to domain StreamingEventKind. Uses switch expression on the oneof case to determine which type to return.
      Parameters:
      proto - the proto StreamResponse
      Returns:
      the corresponding domain streaming event kind
      Throws:
      IllegalArgumentException - if the oneof field is not set