Use the Elvis operator to shorten getObject expressions ?

Tom Zeller tzeller at dragonacea.biz
Tue Oct 13 16:21:11 EDT 2015


The Elvis operator [1] can shorten Spring expressions from :

 #{getObject('shibboleth.SomeBean') != null ? 'shibboleth.SomeBean' : 'shibboleth.DefaultSomeBean’}

to :

 #{getObject('shibboleth.SomeBean’) ?: 'shibboleth.DefaultSomeBean’}

Do we want to do that where possible ?


[1] http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html#expressions-operator-elvis


More information about the dev mailing list