cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Java 8 Optionals
Date Wed, 01 Feb 2017 16:53:20 GMT
I thought of this too. Though I have mixed feelings about using Optional casually. It is good
in processing pipelines. But when used as property return type in Java Beans to indicate nullable
values, it just feels like syntax for the sake of syntax (I tried a few times, reverted back
to normal properties every time).

So how about we try it on a small scale? Add an ExtendedType for it in cayenne-java8, tell
the community, and then sit back and wait if anyone actually wants it :)


> On Feb 1, 2017, at 9:03 PM, Michael Gentry <> wrote:
> Actually, I suppose this might make sense for attributes, too.  Such as a
> User class with a Role attribute that you want to make sure is non-null and
> you are forced handle the null condition with a default Role if something
> happened to your DB value.
> mrg
> On Wed, Feb 1, 2017 at 10:24 AM, Michael Gentry <> wrote:
>> I haven't thought through this too much yet, but wanted to get some
>> feedback if possible.
>> Would it make sense to have an option in CM (and supporting templates/etc)
>> to have Optional as a return type?  This would only be meaningful, I think,
>> on to-one relationships, since to-many will return an empty collection.
>> Thanks,
>> mrg

View raw message