Re: FreeMarker and java.util.Optional
Daniel Dekany <[email protected]> Tue, 2 Dec 2014 23:33:34 +0100
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Not yet AFAIK, but that's good point. I guess FreeMarker should call
Optional.orElse(null) whenever it accesses an Optional. Thus ${user}
and ${user!'unknown'} will work even if `user` is a String or a
Optional<String>.
Monday, December 1, 2014, 12:19:57 PM, Eirik Lygre wrote:
> Hi,
>
> Starting with java 8, java supports the new "Optional" class
> (https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html).
>
> * Did anybody give any thought to how this integrates with
> FreeMarker, for example through a (custom?) ObjectWrapper or the like?
>
> We will probably start exposing certain elements in our java layer
> as Optional<SomeBusinessObject>. We haven't yet really thought about
> how this integrates with FreeMarker, but I thought it better to ask
> sooner rather than later, in case somebody has already been through this!
>
> Eirik
--
Thanks,
Daniel Dekany
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk