instanceof in SpEL



我有一个类的方法:代码:

List<Entity> getData() {...}

和一些扩展了Entity: Project, Phase, Invoice, Payment的类

,我想这样做:

@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"?

正确的SpEL语法应该是filterObject instanceof T(Project)

最新更新