You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Andrew Otto (JIRA)" <ji...@apache.org> on 2014/11/05 18:05:33 UTC

[jira] [Created] (AVRO-1601) Subclasses of Avro generated SpecificRecordBase classes should be considered 'Specific classes'.

Andrew Otto created AVRO-1601:
---------------------------------

             Summary: Subclasses of Avro generated SpecificRecordBase classes should be considered 'Specific classes'.
                 Key: AVRO-1601
                 URL: https://issues.apache.org/jira/browse/AVRO-1601
             Project: Avro
          Issue Type: Improvement
          Components: java
            Reporter: Andrew Otto
            Priority: Minor


The createSchema() method of SpecificData class getDeclaredField("SCHEMA$") to check if the class is a valid 'Specific' Avro schema class.  It'd be nice if generated classes could be extended so convenience methods could be added without modifying the generated class.

E.g. I'd like to convert XML fragments into Avro records, and it would be nice if my record abstraction class contained the logic to do this, rather than keeping it in some utility class elsewhere.  I'd like to extend my generated Avro schema class to add this functionality, but if I do so I can't call getSchema() on my record objects.

To do this, I think the check for the SCHEMA$ field should look at superclasses as well.  Perhaps FieldUtils.getAllFieldList()[1] would do?

[1] http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/reflect/FieldUtils.html#getAllFieldsList%28java.lang.Class%29



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)