You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Rich DiCroce (Jira)" <ji...@apache.org> on 2020/03/02 15:56:00 UTC

[jira] [Updated] (AVRO-2767) Can't easily use Java annotations to set enum default

     [ https://issues.apache.org/jira/browse/AVRO-2767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rich DiCroce updated AVRO-2767:
-------------------------------
    Issue Type: Improvement  (was: Bug)

> Can't easily use Java annotations to set enum default
> -----------------------------------------------------
>
>                 Key: AVRO-2767
>                 URL: https://issues.apache.org/jira/browse/AVRO-2767
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.9.2
>            Reporter: Rich DiCroce
>            Priority: Major
>
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)