I am using the Avro maven plugin to process some Avro files and generate the Java classes. My goal is to tell the plugin to generate Optional getters whenever the field accepts null values, by declaring the type null. For example:
{
"namespace": "br.com.gruposaga.core.event",
"type": "record",
"name": "UserEvent",
"fields": [
{
"name": "id",
"type": "int"
},
{
"name": "name",
"type": "string"
},
{
"name": "email",
"type": [
"null",
"string"
],
"default": null
}
]
}
So, in the definition mentioned above, the plugin should generate default getters for id and name. But for the e-mail, that can be null, I want the plugin to just generate the Optional getter. I tried both gettersReturnOptional and createOptionalGetters configurations in the plugin, but none of them did achieved that. So, how can it be done?