You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Niels Basjes (JIRA)" <ji...@apache.org> on 2015/01/20 10:51:35 UTC

[jira] [Created] (AVRO-1633) Add additional setXxx(Builder) method to make user code more readable.

Niels Basjes created AVRO-1633:
----------------------------------

             Summary: Add additional setXxx(Builder) method to make user code more readable.
                 Key: AVRO-1633
                 URL: https://issues.apache.org/jira/browse/AVRO-1633
             Project: Avro
          Issue Type: Improvement
          Components: java
    Affects Versions: 1.8.0
            Reporter: Niels Basjes
            Assignee: Niels Basjes
             Fix For: 1.8.0


The currently generated code contains these two methods for the Builder instances (code sample was simplified):
{code}public Request.Builder setConnection(NetworkConnection value)
public Request.Builder setConnectionBuilder(NetworkConnection.Builder value){code}

My proposal: Add in addition the method:
{code}public Request.Builder setConnection(NetworkConnection.Builder value){code}

Advantage:
You can do {{.setConnection(something)}} and pass either a {{NetworkConnection}} or a {{NetworkConnection.Builder}}.

Disadvantage:
Explicitly setting a {{null}} will trigger a "Multiple implementations" error and as such will need an explicit typecast.





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