[jira] [Comment Edited] (AVRO-2320) Generate accessors for field aliases (Java specific compiler)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Comment Edited] (AVRO-2320) Generate accessors for field aliases (Java specific compiler)

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/AVRO-2320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16762405#comment-16762405 ]

Gildas Quéméner edited comment on AVRO-2320 at 2/7/19 6:30 AM:
---------------------------------------------------------------

Hello,

 

I've been working on a php compiler ([https://gitlab.com/Jaumo/p[link title|http://example.comhavroc)|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.


was (Author: gildasq):
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
(v7.6.3#76005)