[
https://issues.apache.org/jira/browse/AVRO-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15400569#comment-15400569
]
Yibing Shi commented on AVRO-1890:
----------------------------------
[~ryonday], it is recommended to use record builder to create the specific
records.
{code}
fasdf.Wat.newBuilder().build()
{code}
This builder should be able to assign the default values for the fields.
> Java objects compiled from AVDL disregard default values
> --------------------------------------------------------
>
> Key: AVRO-1890
> URL: https://issues.apache.org/jira/browse/AVRO-1890
> Project: Avro
> Issue Type: Bug
> Reporter: Ryon Day
> Priority: Minor
>
> Given the schema
> {code}
> @namespace("fasdf")
> protocol foo {
> enum Domain {
> COM,
> ORG,
> BIZ,
> MIL
> }
> record Wat {
> Domain domain = "COM";
> string foo = "asfdasdf";
> }
> }
> {code}
> The resulting {{Wat}} Java class does not use the defined default values:
> {code}
> @Test
> public void asdfasdf() throws Exception {
> fasdf.Wat x = new Wat();
> System.out.print(x);
> }
> {code}
> This test results in:
> {code}
> {"domain": null, "foo": null}
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)