avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Amstutz <peter.amst...@curoverse.com>
Subject Re: Avro Create Generic Type
Date Fri, 18 Dec 2015 14:25:58 GMT
Hi Rushi,

Take a look at Schema Salad, it enables you to write a schema with
inheritance and type templating and then run it through a processor to
get a valid Avro schema, among other features:


(since it just converts to valid Avro, you won't get Java generics, though)

On Thu, Dec 17, 2015 at 1:09 PM, Rushi <hrishi.engineer@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
>  *
>  */
> 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!

View raw message