2
我有一個類的方法: 代碼:的instanceof在規劃環境地政司
List<Entity> getData() {...}
和延伸實體的一些類:計劃第二期,發票,付款。
,我願做這樣的事情:
@PostFilter("filterObject instanseof Project ? filterObject.manager == principal : filterObject instanceof Phase ? filterObject.project.manager == principal :
filterObject instanceof Invoice ? filterObject.phase.project == principal : filterObject instanceof Payment ? filterObject.invoice.phase.project.manager == principal : true")
它是一個合法的嗎?或者如何正確使用「instanceof」?