You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sean Busbey (JIRA)" <ji...@apache.org> on 2014/06/29 19:34:24 UTC
[jira] [Commented] (AVRO-1534) Generate shema from a Java object
[ https://issues.apache.org/jira/browse/AVRO-1534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14047178#comment-14047178 ]
Sean Busbey commented on AVRO-1534:
-----------------------------------
Take a look at [the Java reflection API|http://avro.apache.org/docs/1.7.6/api/java/org/apache/avro/reflect/package-summary.html].
Getting a schema looks like:
{code}
Schema schema = ReflectData.get().getSchema(T);
{code}
See [the example from Doug on StackOverflow for a working example|http://stackoverflow.com/questions/11866466/using-apache-avro-reflect].
> Generate shema from a Java object
> ---------------------------------
>
> Key: AVRO-1534
> URL: https://issues.apache.org/jira/browse/AVRO-1534
> Project: Avro
> Issue Type: New Feature
> Components: java
> Reporter: Moustafa Aboul Atta
>
> Instead of having to provide an already compiled schema, there should be the ability to generate the schema from a java object.
> That is because in some case, providing the schema is not posssible (e.g: the class of that Java Object has some members whose types are external java classes in external libraries or simply the Object is too complex).
> Example of how it would be:
> {{Shema schema = new Schema.Parser.parse(T);}}
> Microsoft already implemented this feature in its Avro library for .NET so I was surprised that it wasn't already implemented.
--
This message was sent by Atlassian JIRA
(v6.2#6252)