avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel VanderWerf <joelvanderw...@gmail.com>
Subject Re: using custom builders
Date Wed, 06 Jun 2012 00:01:24 GMT
On 05/17/2012 11:54 AM, Joel VanderWerf wrote:
>
> I'd like to subclass the avro-generated classes.
>
> Is it possible to tell avro to deserialize using a custom builder that
> instantiates my subclasses?
>
> There are some hints in the source code that this might be possible, but
> what I'd really like is a small, working example...

This may be what I'm looking for:

org.apache.avro.specific.SpecificData

The getClass() method perhaps can be overridden to map incoming record 
class names to java classes. Not sure if this is the right way to do it 
though. There's also a getClassName() which might be a better method to 
override.

Any thoughts?

What we are trying to do is emulate JAXB's ObjectFactory 
functionality[1], which lets you specify which subclasses of the 
generated classes are used for deserialization.

-----
[1] http://jaxb.java.net/guide/Adding_behaviors.html

Mime
View raw message