adaptToV2 adapts a V1 Interpretable implementation to the V2 interface. This adapter is used to bridge the legacy Interpretable interface to the modern InterpretableV2 interface, providing a shim that allows the use of both interfaces in the same system.
(i Interpretable)
| 52 | // modern InterpretableV2 interface, providing a shim that allows the use of |
| 53 | // both interfaces in the same system. |
| 54 | func adaptToV2(i Interpretable) InterpretableV2 { |
| 55 | switch v := i.(type) { |
| 56 | case InterpretableV2: |
| 57 | return v |
| 58 | default: |
| 59 | return &v1Adapter{Interpretable: v} |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // v1Adapter handles bridging a V1 Interpretable implementation to the V2 interface. |
| 64 | type v1Adapter struct { |
no outgoing calls