Package org.a2aproject.sdk.grpc.mapper
Interface PartMapper
- All Known Implementing Classes:
PartMapperImpl
public interface PartMapper
Mapper between
Part and Part.
Handles polymorphic Part conversion using the proto's oneof content field:
- TextPart - maps to Part.text
- FilePart(FileWithBytes) - maps to Part.raw + Part.filename + Part.media_type
- FilePart(FileWithUri) - maps to Part.url + Part.filename + Part.media_type
- DataPart - maps to Part.data (google.protobuf.Value containing any JSON value: object, array, primitive, or null)
Manual Implementation Required: Must use manual instanceof dispatch to handle protobuf oneof pattern, as MapStruct's @SubclassMapping maps to different target types, not different fields of the same type.
-
Field Summary
Fields -
Method Summary
-
Field Details
-
INSTANCE
-
-
Method Details
-
toProto
Converts domain Part to proto Part. Handles TextPart, FilePart (FileWithBytes and FileWithUri), and DataPart polymorphism. -
fromProto
Converts proto Part to domain Part. Reconstructs TextPart, FilePart, or DataPart based on oneof content field.
-