You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2013/07/10 00:01:49 UTC

[jira] [Commented] (AVRO-1261) Honor schema defaults with the Constructor in addition to the builders.

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

ASF subversion and git services commented on AVRO-1261:
-------------------------------------------------------

Commit 1501581 from [~cutting]
[ https://svn.apache.org/r1501581 ]

AVRO-1261. Clarify in documentation that generated no-arg constructors do not use default values from schema.
                
> Honor schema defaults with the Constructor in addition to the builders.
> -----------------------------------------------------------------------
>
>                 Key: AVRO-1261
>                 URL: https://issues.apache.org/jira/browse/AVRO-1261
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.4
>            Reporter: Christopher Conner
>            Assignee: Doug Cutting
>            Priority: Minor
>             Fix For: 1.7.5
>
>         Attachments: AVRO-1261.patch
>
>
> As I understand it, currently if you want to utilize defaults in a schema, ie:
> { 
> "namespace": "com.chris.test", 
> "type": "record", 
> "name": "CHRISTEST", 
> "doc": "Chris Test", 
> "fields": [ 
> {"name": "firstname", "type": "string", "default": "Chris"}, 
> {"name": "lastname", "type": "string", "default": "Conner"}, 
> {"name": "username", "type": "string", "default": "cconner"}
> ] 
> }
> Then I have to use the builders to create my objects.  IE:
> public class ChrisAvroTest {
> public static void main(String[] args) throws Exception {
> CHRISTEST person = CHRISTEST.newBuilder() 
> .build(); 
> System.out.println("person:" + person);
> } 
> }
> Is my understanding correct?  Is it possible to make it so the default constructor as well?

--
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