You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Gildas Quéméner (JIRA)" <ji...@apache.org> on 2019/02/07 06:30:00 UTC

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

    [ 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 commented on AVRO-2320:
---------------------------------------

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)