Use the Elvis operator to shorten getObject expressions ?
Cantor, Scott
cantor.2 at osu.edu
Tue Oct 13 16:36:22 EDT 2015
On 10/13/15, 4:21 PM, "dev on behalf of Tom Zeller" <dev-bounces at shibboleth.net on behalf of tzeller at dragonacea.biz> wrote:
>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).
But yes, I've used it a few places.
-- Scott
More information about the dev
mailing list