Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1261

Honor schema defaults with the Constructor in addition to the builders.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.4
    • Fix Version/s: 1.7.5
    • Component/s: java
    • Labels:
      None

      Description

      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?

        Attachments

        1. AVRO-1261.patch
          0.8 kB
          Doug Cutting

          Activity

            People

            • Assignee:
              cutting Doug Cutting
              Reporter:
              cconner Christopher Conner
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: