You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Michal Sabo (Jira)" <ji...@apache.org> on 2023/01/02 09:23:00 UTC
[jira] [Commented] (AVRO-2544) Allow avro-maven-plugin to generate Java classes that implement interfaces
[ https://issues.apache.org/jira/browse/AVRO-2544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653543#comment-17653543 ]
Michal Sabo commented on AVRO-2544:
-----------------------------------
You may probably find it useful, there is already an Avro compiler extension specificaly providing the these features - https://github.com/sabomichal/avro-compiler-extension
> 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
> Priority: Major
>
> 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.20.10#820010)