Use the Elvis operator to shorten getObject expressions ?

Tom Zeller tzeller at dragonacea.biz
Tue Oct 13 16:41:13 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 ?
> 
> That specific example wouldn't work because the two alternatives aren't the same type (one would be a bean directly, the other a bean by reference).

Right, sorry, that is a bad example.


More information about the dev mailing list