Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

instanceof in SpEL

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

like image 614
Stanislau Avatar asked Oct 02 '11 18:10

Stanislau


1 Answers

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

like image 161
jeha Avatar answered Oct 06 '22 01:10

jeha