You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Doug Cutting (JIRA)" <ji...@apache.org> on 2012/09/11 00:10:07 UTC

[jira] [Commented] (AVRO-1149) Add all-args constructor to generated class definitions

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

Doug Cutting commented on AVRO-1149:
------------------------------------

Using such constructors makes code more fragile.  For example, adding a new field with a default value would require changes that builder-based code would not need to make.  Also, if you change the order of fields of the same type then code that's probably now buggy will continue to compile without warning.  But just because we emit such constructors doesn't mean folks have to use them.

So I'm okay committing this.  Does anyone else have any objections?
                
> Add all-args constructor to generated class definitions
> -------------------------------------------------------
>
>                 Key: AVRO-1149
>                 URL: https://issues.apache.org/jira/browse/AVRO-1149
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Gabriel Reid
>         Attachments: AVRO-1149.patch
>
>
> Having an all-args constructor (in addition to the default no-args constructor) can make it a lot easier to work with generated Avro classes directly, as it allows setting up the state of the class in one call.
> The included builders are useful for this, but the use of the builder can be overly verbose and not very readable when a small number of parameters are involved.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira