开发者

instanceof in SpEL

开发者 https://www.devze.com 2023-04-09 19:36 出处:网络
i have a class with the method: Code: List<Entity> getData() {...} and some classes which extends Entity: Project, Phase, Invoice, Payment.

i have a class with the method: Code:

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

and some classes which extends Entity: Project, Phase, Invoice, Payment.

and i would like to do something like this:

@PostFilter("filterObject开发者_Python百科 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")

is it a legal? or how to use "instanceof" correctly?


The correct syntax for SpEL would be like filterObject instanceof T(Project). (Please see SpEL section 6.5.6.1 - Relational operators)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号