You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sharmarke Aden (JIRA)" <ji...@apache.org> on 2012/11/14 16:54:12 UTC

[jira] [Created] (AVRO-1205) Add Stereotype Annotation to Generated Beans

Sharmarke Aden created AVRO-1205:
------------------------------------

             Summary: Add Stereotype Annotation to Generated Beans
                 Key: AVRO-1205
                 URL: https://issues.apache.org/jira/browse/AVRO-1205
             Project: Avro
          Issue Type: New Feature
          Components: java
    Affects Versions: 1.7.2
            Reporter: Sharmarke Aden
            Priority: Minor


Avro generated schema beans currently lack a formal way of distinguishing them as Avro schema beans at runtime. I would like to propose that a new stereotype annotation be added to Avro Core and the ability to have all Avro generated schema beans annotated with this newly created stereotype annotation.

I'm planning on adding a FallbackTypeConverter to the Camel-Avro project and I hoping this feature will allow me to cleanly detect Avro beans for conversion at runtime.


If this feature is implemented Avro schema beans would look something like this:

{code}
...

@org.apache.avro.reflect.AvroSchema
public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {

...

}
...
{code}


The maven plugin configuration would look something like this:

{code}
<plugin>
  <groupId>org.apache.avro</groupId>
  <artifactId>avro-maven-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>schema</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
   <stereotype>true</stereotype>
  </configuration>
</plugin>
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (AVRO-1205) Add Stereotype Annotation to Generated Beans

Posted by "Sharmarke Aden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sharmarke Aden updated AVRO-1205:
---------------------------------

    Attachment: vcs-diff6870599675664484518.patch
    
> Add Stereotype Annotation to Generated Beans
> --------------------------------------------
>
>                 Key: AVRO-1205
>                 URL: https://issues.apache.org/jira/browse/AVRO-1205
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Sharmarke Aden
>            Priority: Minor
>         Attachments: vcs-diff6870599675664484518.patch
>
>
> Avro generated schema beans currently lack a formal way of distinguishing them as Avro schema beans at runtime. I would like to propose that a new stereotype annotation be added to Avro Core and the ability to have all Avro generated schema beans annotated with this newly created stereotype annotation.
> I'm planning on adding a FallbackTypeConverter to the Camel-Avro project and I hoping this feature will allow me to cleanly detect Avro beans for conversion at runtime.
> If this feature is implemented Avro schema beans would look something like this:
> {code}
> ...
> @org.apache.avro.reflect.AvroSchema
> public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
> ...
> }
> ...
> {code}
> The maven plugin configuration would look something like this:
> {code}
> <plugin>
>   <groupId>org.apache.avro</groupId>
>   <artifactId>avro-maven-plugin</artifactId>
>   <executions>
>     <execution>
>       <goals>
>         <goal>schema</goal>
>       </goals>
>     </execution>
>   </executions>
>   <configuration>
>    <stereotype>true</stereotype>
>   </configuration>
> </plugin>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AVRO-1205) Add Stereotype Annotation to Generated Beans

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497585#comment-13497585 ] 

Doug Cutting commented on AVRO-1205:
------------------------------------

Adding an annotation to emitted classes seems reasonable.

Is there any harm in always generating the annotation?  Why make it optional?

Also, if the annotation is emitted by the specific compiler it should probably be in the package org.apache.avro.specific, not org.apache.avro.reflect, no?

Finally, I note that Java has an annotation for generated code:

http://docs.oracle.com/javase/6/docs/api/javax/annotation/Generated.html

We could instead emit this as something like:

{code}
@javax.annotation.Generated(value = { "avro" });
{code}

but that would be harder to check, since you couldn't just call Class#isAnnotationPresent().
                
> Add Stereotype Annotation to Generated Beans
> --------------------------------------------
>
>                 Key: AVRO-1205
>                 URL: https://issues.apache.org/jira/browse/AVRO-1205
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Sharmarke Aden
>            Priority: Minor
>
> Avro generated schema beans currently lack a formal way of distinguishing them as Avro schema beans at runtime. I would like to propose that a new stereotype annotation be added to Avro Core and the ability to have all Avro generated schema beans annotated with this newly created stereotype annotation.
> I'm planning on adding a FallbackTypeConverter to the Camel-Avro project and I hoping this feature will allow me to cleanly detect Avro beans for conversion at runtime.
> If this feature is implemented Avro schema beans would look something like this:
> {code}
> ...
> @org.apache.avro.reflect.AvroSchema
> public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
> ...
> }
> ...
> {code}
> The maven plugin configuration would look something like this:
> {code}
> <plugin>
>   <groupId>org.apache.avro</groupId>
>   <artifactId>avro-maven-plugin</artifactId>
>   <executions>
>     <execution>
>       <goals>
>         <goal>schema</goal>
>       </goals>
>     </execution>
>   </executions>
>   <configuration>
>    <stereotype>true</stereotype>
>   </configuration>
> </plugin>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AVRO-1205) Add Stereotype Annotation to Generated Beans

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13500633#comment-13500633 ] 

Doug Cutting commented on AVRO-1205:
------------------------------------

Patch looks good.  A few minor comments:
 - The annotation interface needs some javadoc describing how it's used.
 - A better name might be AvroGenerated instead of AvroSchema?
 - Should we also annotate generated protocol interfaces?
                
> Add Stereotype Annotation to Generated Beans
> --------------------------------------------
>
>                 Key: AVRO-1205
>                 URL: https://issues.apache.org/jira/browse/AVRO-1205
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Sharmarke Aden
>            Priority: Minor
>         Attachments: vcs-diff6870599675664484518.patch
>
>
> Avro generated schema beans currently lack a formal way of distinguishing them as Avro schema beans at runtime. I would like to propose that a new stereotype annotation be added to Avro Core and the ability to have all Avro generated schema beans annotated with this newly created stereotype annotation.
> I'm planning on adding a FallbackTypeConverter to the Camel-Avro project and I hoping this feature will allow me to cleanly detect Avro beans for conversion at runtime.
> If this feature is implemented Avro schema beans would look something like this:
> {code}
> ...
> @org.apache.avro.reflect.AvroSchema
> public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
> ...
> }
> ...
> {code}
> The maven plugin configuration would look something like this:
> {code}
> <plugin>
>   <groupId>org.apache.avro</groupId>
>   <artifactId>avro-maven-plugin</artifactId>
>   <executions>
>     <execution>
>       <goals>
>         <goal>schema</goal>
>       </goals>
>     </execution>
>   </executions>
>   <configuration>
>    <stereotype>true</stereotype>
>   </configuration>
> </plugin>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AVRO-1205) Add Stereotype Annotation to Generated Beans

Posted by "Sharmarke Aden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13500022#comment-13500022 ] 

Sharmarke Aden commented on AVRO-1205:
--------------------------------------

Here is a patch that adds an annotation called AvroSchema and annotates generated beans with it.
                
> Add Stereotype Annotation to Generated Beans
> --------------------------------------------
>
>                 Key: AVRO-1205
>                 URL: https://issues.apache.org/jira/browse/AVRO-1205
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Sharmarke Aden
>            Priority: Minor
>         Attachments: vcs-diff6870599675664484518.patch
>
>
> Avro generated schema beans currently lack a formal way of distinguishing them as Avro schema beans at runtime. I would like to propose that a new stereotype annotation be added to Avro Core and the ability to have all Avro generated schema beans annotated with this newly created stereotype annotation.
> I'm planning on adding a FallbackTypeConverter to the Camel-Avro project and I hoping this feature will allow me to cleanly detect Avro beans for conversion at runtime.
> If this feature is implemented Avro schema beans would look something like this:
> {code}
> ...
> @org.apache.avro.reflect.AvroSchema
> public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
> ...
> }
> ...
> {code}
> The maven plugin configuration would look something like this:
> {code}
> <plugin>
>   <groupId>org.apache.avro</groupId>
>   <artifactId>avro-maven-plugin</artifactId>
>   <executions>
>     <execution>
>       <goals>
>         <goal>schema</goal>
>       </goals>
>     </execution>
>   </executions>
>   <configuration>
>    <stereotype>true</stereotype>
>   </configuration>
> </plugin>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (AVRO-1205) Add Stereotype Annotation to Generated Beans

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting resolved AVRO-1205.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.7.3
         Assignee: Sharmarke Aden

I committed this.  Thanks, Sharmarke!
                
> Add Stereotype Annotation to Generated Beans
> --------------------------------------------
>
>                 Key: AVRO-1205
>                 URL: https://issues.apache.org/jira/browse/AVRO-1205
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Sharmarke Aden
>            Assignee: Sharmarke Aden
>            Priority: Minor
>             Fix For: 1.7.3
>
>         Attachments: vcs-diff6870599675664484518.patch, vcs-diff7678145690419942974.patch
>
>
> Avro generated schema beans currently lack a formal way of distinguishing them as Avro schema beans at runtime. I would like to propose that a new stereotype annotation be added to Avro Core and the ability to have all Avro generated schema beans annotated with this newly created stereotype annotation.
> I'm planning on adding a FallbackTypeConverter to the Camel-Avro project and I hoping this feature will allow me to cleanly detect Avro beans for conversion at runtime.
> If this feature is implemented Avro schema beans would look something like this:
> {code}
> ...
> @org.apache.avro.reflect.AvroSchema
> public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
> ...
> }
> ...
> {code}
> The maven plugin configuration would look something like this:
> {code}
> <plugin>
>   <groupId>org.apache.avro</groupId>
>   <artifactId>avro-maven-plugin</artifactId>
>   <executions>
>     <execution>
>       <goals>
>         <goal>schema</goal>
>       </goals>
>     </execution>
>   </executions>
>   <configuration>
>    <stereotype>true</stereotype>
>   </configuration>
> </plugin>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AVRO-1205) Add Stereotype Annotation to Generated Beans

Posted by "Sharmarke Aden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497682#comment-13497682 ] 

Sharmarke Aden commented on AVRO-1205:
--------------------------------------

There is no harm in always adding an annotation to emitted classes and doing so would preferable. I don't know enough about package placement preference in Avro so I will deffer to you on the matter. 

With respect to using Generated annotation, I believe annotating all generated beans using standard annotations would be wise but as you've mentioned it makes runtime detection of Avro beans a bit more cumbersome and clunky. My preference is to have Avro own its annotation(s) much like JAXB and various other frameworks. 
                
> Add Stereotype Annotation to Generated Beans
> --------------------------------------------
>
>                 Key: AVRO-1205
>                 URL: https://issues.apache.org/jira/browse/AVRO-1205
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Sharmarke Aden
>            Priority: Minor
>
> Avro generated schema beans currently lack a formal way of distinguishing them as Avro schema beans at runtime. I would like to propose that a new stereotype annotation be added to Avro Core and the ability to have all Avro generated schema beans annotated with this newly created stereotype annotation.
> I'm planning on adding a FallbackTypeConverter to the Camel-Avro project and I hoping this feature will allow me to cleanly detect Avro beans for conversion at runtime.
> If this feature is implemented Avro schema beans would look something like this:
> {code}
> ...
> @org.apache.avro.reflect.AvroSchema
> public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
> ...
> }
> ...
> {code}
> The maven plugin configuration would look something like this:
> {code}
> <plugin>
>   <groupId>org.apache.avro</groupId>
>   <artifactId>avro-maven-plugin</artifactId>
>   <executions>
>     <execution>
>       <goals>
>         <goal>schema</goal>
>       </goals>
>     </execution>
>   </executions>
>   <configuration>
>    <stereotype>true</stereotype>
>   </configuration>
> </plugin>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira