avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom White (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1961) [JAVA] Generate getters that return an Optional
Date Wed, 30 Nov 2016 13:20:58 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15708587#comment-15708587
] 

Tom White commented on AVRO-1961:
---------------------------------

For compatibility reasons, I don't think getFoo() should ever return Optional<Foo>.
Having getOptionalFoo() is much clearer and safer. Also, I noticed that the creator of Optional
said "I think routinely using it as a return value for getters would definitely be over-use",
http://stackoverflow.com/a/26328555, so it's not necessarily true that everyone will want
this feature. In other words, it may never become the default.

Avro allows you to set the directory to load velocity templates from (by setting the org.apache.avro.specific.templates
system property), so it should be possible to try this out with an existing Avro release.
You would create a copy of the existing templates and change record.vm to have the getOptional*()
methods.

> [JAVA] Generate getters that return an Optional
> -----------------------------------------------
>
>                 Key: AVRO-1961
>                 URL: https://issues.apache.org/jira/browse/AVRO-1961
>             Project: Avro
>          Issue Type: New Feature
>            Reporter: Niels Basjes
>            Assignee: Niels Basjes
>            Priority: Minor
>
> A colleague of mine indicated that having getters that return an Optional (java 8 thingy)
would be very useful for him.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message