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

Can't easily use Java annotations to set enum default

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.9.2
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None

      Description

      1.9.0 introduced support for enum default values. There's currently not an easy way to set an enum's default value when using Java annotations:

      • AvroDefault cannot be applied to a class.
      • AvroMeta can be applied to a class, but has no effect on an enum class. Not sure if that's a bug or not. Even if it could, "default" is a reserved name so presumably that would cause an error.

      The only solution I can find is to apply AvroSchema to the enum class and define everything, even though the only thing I want to set is the default.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                rdicroce Rich DiCroce
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: