You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Philip Zeyliger (JIRA)" <ji...@apache.org> on 2009/12/04 19:55:20 UTC

[jira] Commented: (AVRO-241) add union annotation to reflect API

    [ https://issues.apache.org/jira/browse/AVRO-241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786071#action_12786071 ] 

Philip Zeyliger commented on AVRO-241:
--------------------------------------

Looks good.

bq. static final String CLASS_PROP = "java-class";

I think the properties that the reflect API uses become de facto part of the API for using Java reflection.  So they're probably public, and probably should be referenced in JavaDoc somewhere.

{quote}
  // if array element type is a class with a union annotation, note it
  // this is required because we cannot set a property on the union itself 
{quote}
typo: extra "it" at end of first line

bq. private void setElement(Schema schema, Type element) 

Consider renaming this method a little bit.  Perhaps "annotateElementIfUnion()"?  Or "setElementProperties"?

bq. if (collectionClass.isAssignableFrom(ArrayList.class))

The valid things that can be put in the annotation probably deserves some documentation.  It seems like List, and all concrete classes with empty constructors, work.  Set, however, would trigger an exception.

You've annotated a bunch of the R? inner classes in the tests, which is great.  R9 could be annotated to note that it's checking arrays of unions...

> add union annotation to reflect API
> -----------------------------------
>
>                 Key: AVRO-241
>                 URL: https://issues.apache.org/jira/browse/AVRO-241
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Doug Cutting
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>
>         Attachments: AVRO-241.patch, AVRO-241.patch, AVRO-241.patch
>
>
> In existing Hadoop RPC interfaces one can use an abstract base class or interface in a method declaration, and then pass different instantiable subclasses, since Hadoop RPC tags parameters and return types with their runtime java class name.  To permit such interfaces to be supported by Avro reflection we can add a Union annotation that can be added to the base class, declaring its instantiable subclasses for Avro.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.