Interface PartMapper_v0_3

All Known Implementing Classes:
PartMapper_v0_3Impl

public interface PartMapper_v0_3
Bidirectional mapper for converting Part types between A2A Protocol v0.3 and v1.0.

Handles polymorphic Part conversion for:

Key differences:

  • v0.3: Part types are records with accessor methods (e.g., text(), metadata())
  • v1.0: Part types are records with accessor methods (e.g., text(), metadata())

Uses manual instanceof dispatch to handle polymorphic conversion.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PartMapper_v0_3
    Singleton instance accessed via A2AMappers_v0_3 factory.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Part_v0_3<?>
    fromV10(Part<?> v10)
    Converts v1.0 Part to v0.3 Part.
    default Part<?>
    toV10(Part_v0_3<?> v03)
    Converts v0.3 Part to v1.0 Part.
  • Field Details

  • Method Details

    • toV10

      default Part<?> toV10(Part_v0_3<?> v03)
      Converts v0.3 Part to v1.0 Part.

      Handles TextPart, FilePart, and DataPart polymorphism using instanceof dispatch.

      Parameters:
      v03 - the v0.3 part
      Returns:
      the equivalent v1.0 part
      Throws:
      InvalidRequestError - if the part type is unrecognized
    • fromV10

      default Part_v0_3<?> fromV10(Part<?> v10)
      Converts v1.0 Part to v0.3 Part.

      Handles TextPart, FilePart, and DataPart polymorphism using instanceof dispatch.

      Parameters:
      v10 - the v1.0 part
      Returns:
      the equivalent v0.3 part
      Throws:
      InvalidRequestError - if the part type is unrecognized