For me, my beans are parsed from JSON and allow partial updates. So, for
example, I can PUT /user/1 {"emailAddress": "[email protected]"} in order to
only update the email_address. So I write my bean to record code like this:
private static UserRecord newRecord(UserBean bean) {
UserRecord record = new UserRecord();
bean.getFirstName().ifPresent(record::setFirstName);
bean.getLastName().ifPresent(record::setLastName);
bean.getEmailAddress().ifPresent(record::setEmailAddress);
bean.getPhoneNumberE164().ifPresent(record::setPhoneNumberE164);
return record;
}
So if a getter uses Optional I suppose I would want it to work like this.
Of course other people don't see it as good practice to have a getter
return an Optional at all. But for my use case it works well to tell the
difference between a specified value and an absent value that has been
parsed from JSON.
R.
On Wed, Sep 16, 2015 at 5:31 AM, Lukas Eder <[email protected]> wrote:
>
>
> 2015-09-15 17:52 GMT+02:00 Robert DiFalco <[email protected]>:
>
>> Thanks Lukas, unfortunately it does not handle Optional<T>.
>>
>
> Hmm, good point. We should certainly add Optional support to
> org.jooq.tools.Convert (https://github.com/jOOQ/jOOQ/issues/4565), and
> perhaps to other data type conversion methods.
>
> Would you mind sharing a little more insight into your use-case? What is
> your current usage of Optional and what are your expectations towards jOOQ
> in this area?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "jOOQ User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jooq-user/_8KYcum-8H4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.