2016-02-29 37 views
0

我有一個節儉IDL如下:如何查看在Thrift IDL中設置了哪個「union」屬性?

union Container { 
    1: Point point; 
    2: Polygon polygon; 
} 

如果我有一個Container對象,我怎麼能檢查Container是否是PointPolygon?似乎應該是檢查一件微不足道的小事,但我無法弄清楚如何...

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 

回答

相關問題