[
https://issues.apache.org/jira/browse/AVRO-1961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15713643#comment-15713643
]
Yibing Shi commented on AVRO-1961:
----------------------------------
{quote}
Actually, on the setter/builder/constructor, we could even go a step further: a
required field with a default value could be with Optional<Foo> as well. The
matching getter would be without Optional. It would make the concept of default
value type safe just as well. Sweet isn't it?
{quote}
And Optional object indicates that the value could be null. It has a different
meaning than having a default value. That is, you can skip passing in a value
for this field doesn't mean you can pass in a null value for this field.
Suggest not to apply this to fields with default values.
{quote}
1. Java 8 isn't required for Avro project for this to work
All the "magic" happen uniquely through the template: the code could still
compile with Java 6, but anyone using the "pojoWithOptional" flag should
consume the generated pojo with Java 8 or backport Optional.
{quote}
Is Java 8 is needed to test the pojoWithOptionalGenerationTest you are going to
add?
> [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)