[
https://issues.apache.org/jira/browse/AVRO-2320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chris Thistlethwaite updated AVRO-2320:
---------------------------------------
Comment: was deleted
(was: Hello,
I've been working on a php compiler (https://gitlab.com/Jaumo/phavroc) and had
a similar reflexion about handling aliases.
IMO, we could go a step further:
- Field aliases could trigger generation of both accessors (getter and setter)
with the same body but a different name.
- Named schema aliases could trigger generation of a child class (with the
alias name).
I don't know to what extent the current java compiler is supporting such
features, but here are some examples in php:
[https://gitlab.com/Jaumo/phavroc/issues/3.]
Regards.)
> Generate accessors for field aliases (Java specific compiler)
> -------------------------------------------------------------
>
> Key: AVRO-2320
> URL: https://issues.apache.org/jira/browse/AVRO-2320
> Project: Apache Avro
> Issue Type: Improvement
> Reporter: Denis Washington
> Priority: Major
>
> Currently, adding aliases to a field has no effect on the output class
> generated by SpecificCompiler. To make incremental code evolution easier, it
> would be beneficial if for each field alias, the compiler would generate
> corresponding a getter, setter and builder method with the aliased name that
> points to the same field. So for instance, a field like:
> {code:java}
> {
> "name": "firstName",
> "type": "string",
> "aliases": ["surname"]
> }{code}
> would be compiled to the following set of getter methods:
> {code:java}
> public String getFirstName() {
> return firstName;
> }
> public String getSurname() {
> return firstName;
> }{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)