Hey, Rushi.

AFAIK, there is no support for generating generic types or inheritance
relationship between types through Avro compiler.

One thing that you can try is customize generated code by replacing
Velocity templates with your own (record.vm, for instance) and then achieve
the desired result (the generic type parameterization, in your case). Would
this fit your needs?

On Thu, Dec 17, 2015 at 3:09 PM, Rushi <hrishi.engin...@gmail.com> wrote:

> I am fairly certain that this is not possible currently, but thought I
> should ask anyway.
>
> In Avro, is there a way to create generic types using schema files? As an
> example, this is what I am looking to create:
>
> /**
>  * Autogenerated by Avro
>  *
>  * DO NOT EDIT DIRECTLY
>  */public class MyAvroType<T> {
>   private Object value;  // value will be of type T.}
>
> Here, this parameterized java class would be generated by the
> avro-maven-plugin or any other available plugin using the avsc files.
>
> What I am trying to solve is, to know the type of the value that will get
> stored in the avro object so that I can find out any class compatibility
> issues at compile time rather than at runtime.
>
> Thanks!
>

Reply via email to