You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Michael Snell (Jira)" <ji...@apache.org> on 2019/09/02 10:33:00 UTC

[jira] [Created] (AVRO-2544) Allow avro-maven-plugin to generate Java classes that implement interfaces

Michael Snell created AVRO-2544:
-----------------------------------

             Summary: Allow avro-maven-plugin to generate Java classes that implement interfaces 
                 Key: AVRO-2544
                 URL: https://issues.apache.org/jira/browse/AVRO-2544
             Project: Apache Avro
          Issue Type: Wish
          Components: java
    Affects Versions: 1.9.0
            Reporter: Michael Snell


Currently Java code generated by the avro-maven-pluginĀ  implements the org.apache.avro.specific.SpecificRecord interface, but there is no ability to have the generated code implement additional interfaces, which would make it possible to improve type-safety and readability.

Similar to the already existing @java-class annotation ([https://avro.apache.org/docs/current/idl.html#minutiae_annotations]) I suggest adding a @java-implements annotation that could be added to a record definition:
{code:java}
@java-implements("an.example.JavaInterface")
record AnExampleRecord {
...{code}
This would be used by the avro-maven-plugin when generating Java code such that the result implements both SpecificRecord and the specified interface:
{code:java}
public class AnExampleRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord , an.example.JavaInterface{code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)