Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Avro, mail # user - using custom builders


+
Joel VanderWerf 2012-05-17, 18:54
+
Joel VanderWerf 2012-06-06, 00:01
Copy link to this message
-
Re: using custom builders
Doug Cutting 2012-06-06, 17:16
On 06/05/2012 05:01 PM, Joel VanderWerf wrote:
> 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?

Overriding one of the two of these sounds like the right thing.
getClass() is implemented in terms of getClassName(), so if getClass()
otherwise does what you want and supplying a different class name is
sufficient then just override getClassName().  If you need to instead
override getClass() then you'll probably want to invoke super.getClass()
for non-record schemas.

I hope this helps.

Doug