0
我有一個節儉IDL如下:如何查看在Thrift IDL中設置了哪個「union」屬性?
union Container {
1: Point point;
2: Polygon polygon;
}
如果我有一個Container
對象,我怎麼能檢查Container
是否是Point
或Polygon
?似乎應該是檢查一件微不足道的小事,但我無法弄清楚如何...
Container container = <some-container>
Point point = container.getPoint(); // will error if the container is a polygon
Polygon polygon = container.getPolygon(); // will error if the container is a point