Author: cutting
Date: Wed Nov 21 22:57:28 2012
New Revision: 1412352
URL: http://svn.apache.org/viewvc?rev=1412352&view=rev
Log:
AVRO-1205. Java: Add stereotype annotation to generated classes. Contributed
by Sharmarke Aden.
Added:
avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java
(with props)
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/protocol.vm
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
avro/trunk/lang/java/tools/src/test/compiler/output/Player.java
avro/trunk/lang/java/tools/src/test/compiler/output/Position.java
Modified: avro/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1412352&r1=1412351&r2=1412352&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed Nov 21 22:57:28 2012
@@ -21,6 +21,11 @@ Trunk (not yet released)
AVRO-1202. Java & Python: Add "Getting Started" guides.
(Skye Wanderman-Milne via cutting)
+ AVRO-1205. Java: Add stereotype annotation to generated classes.
+ All classes generated by the specific compiler now have the
+ annotation org.apache.avro.specific.AvroGenerated.
+ (Sharmarke Aden via cutting)
+
IMPROVEMENTS
AVRO-1169. Java: Reduce memory footprint of resolver.
Added:
avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java?rev=1412352&view=auto
==============================================================================
---
avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java
(added)
+++
avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java
Wed Nov 21 22:57:28 2012
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avro.specific;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that an annotated class is an Avro generated class. All Avro
+ * generated classes will be annotated with this annotation.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AvroGenerated {
+}
Propchange:
avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm?rev=1412352&r1=1412351&r2=1412352&view=diff
==============================================================================
---
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm
(original)
+++
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm
Wed Nov 21 22:57:28 2012
@@ -25,6 +25,7 @@ package $schema.getNamespace();
#foreach ($annotation in $this.javaAnnotations($schema))
@$annotation
#end
[email protected]
public enum ${this.mangle($schema.getName())} {
#foreach ($symbol in ${schema.getEnumSymbols()})${this.mangle($symbol)}#if
($velocityHasNext), #end#end
;
Modified:
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm?rev=1412352&r1=1412351&r2=1412352&view=diff
==============================================================================
---
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
(original)
+++
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
Wed Nov 21 22:57:28 2012
@@ -26,6 +26,7 @@ package $schema.getNamespace();
@$annotation
#end
@org.apache.avro.specific.FixedSize($schema.getFixedSize())
[email protected]
public class ${this.mangle($schema.getName())} extends
org.apache.avro.specific.SpecificFixed {
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("${this.javaEscape($schema.toString())}");
Modified:
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/protocol.vm
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/protocol.vm?rev=1412352&r1=1412351&r2=1412352&view=diff
==============================================================================
---
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/protocol.vm
(original)
+++
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/protocol.vm
Wed Nov 21 22:57:28 2012
@@ -26,6 +26,7 @@ package $protocol.getNamespace();
#foreach ($annotation in $this.javaAnnotations($protocol))
@$annotation
#end
[email protected]
public interface $this.mangle($protocol.getName()) {
public static final org.apache.avro.Protocol PROTOCOL =
org.apache.avro.Protocol.parse("${this.javaEscape($protocol.toString())}");
#foreach ($e in $protocol.getMessages().entrySet())
Modified:
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm?rev=1412352&r1=1412351&r2=1412352&view=diff
==============================================================================
---
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
(original)
+++
avro/trunk/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
Wed Nov 21 22:57:28 2012
@@ -25,6 +25,7 @@ package $schema.getNamespace();
#foreach ($annotation in $this.javaAnnotations($schema))
@$annotation
#end
[email protected]
public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends
org.apache.avro.specific.SpecificExceptionBase#else extends
org.apache.avro.specific.SpecificRecordBase#end implements
org.apache.avro.specific.SpecificRecord {
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("${this.javaEscape($schema.toString())}");
#foreach ($field in $schema.getFields())
Modified: avro/trunk/lang/java/tools/src/test/compiler/output/Player.java
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/java/tools/src/test/compiler/output/Player.java?rev=1412352&r1=1412351&r2=1412352&view=diff
==============================================================================
--- avro/trunk/lang/java/tools/src/test/compiler/output/Player.java (original)
+++ avro/trunk/lang/java/tools/src/test/compiler/output/Player.java Wed Nov 21
22:57:28 2012
@@ -5,6 +5,7 @@
*/
package avro.examples.baseball;
@SuppressWarnings("all")
[email protected]
public class Player extends org.apache.avro.specific.SpecificRecordBase
implements org.apache.avro.specific.SpecificRecord {
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Player\",\"namespace\":\"avro.examples.baseball\",\"fields\":[{\"name\":\"number\",\"type\":\"int\"},{\"name\":\"first_name\",\"type\":\"string\"},{\"name\":\"last_name\",\"type\":\"string\"},{\"name\":\"position\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"enum\",\"name\":\"Position\",\"symbols\":[\"P\",\"C\",\"B1\",\"B2\",\"B3\",\"SS\",\"LF\",\"CF\",\"RF\",\"DH\"]}}}]}");
@Deprecated public int number;
Modified: avro/trunk/lang/java/tools/src/test/compiler/output/Position.java
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/java/tools/src/test/compiler/output/Position.java?rev=1412352&r1=1412351&r2=1412352&view=diff
==============================================================================
--- avro/trunk/lang/java/tools/src/test/compiler/output/Position.java (original)
+++ avro/trunk/lang/java/tools/src/test/compiler/output/Position.java Wed Nov
21 22:57:28 2012
@@ -5,6 +5,7 @@
*/
package avro.examples.baseball;
@SuppressWarnings("all")
[email protected]
public enum Position {
P, C, B1, B2, B3, SS, LF, CF, RF, DH ;
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"Position\",\"namespace\":\"avro.examples.baseball\",\"symbols\":[\"P\",\"C\",\"B1\",\"B2\",\"B3\",\"SS\",\"LF\",\"CF\",\"RF\",\"DH\"]}");