This is an automated email from the ASF dual-hosted git repository.
dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new e2e11cb [AVRO-2129] Add getEncoder method to match getDecoder Closes
#277
e2e11cb is described below
commit e2e11cba3303b189f090383c931f0ae60c4fa952
Author: Daniel Kulp <[email protected]>
AuthorDate: Thu Nov 29 14:33:48 2018 -0500
[AVRO-2129] Add getEncoder method to match getDecoder
Closes #277
---
.../avro/compiler/specific/templates/java/classic/record.vm | 8 ++++++++
.../compiler/output-string/avro/examples/baseball/Player.java | 8 ++++++++
lang/java/tools/src/test/compiler/output/Player.java | 8 ++++++++
3 files changed, 24 insertions(+)
diff --git
a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
index bef1425..25b4101 100644
---
a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
+++
b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
@@ -51,6 +51,14 @@ public class ${this.mangle($schema.getName())}#if
($schema.isError()) extends or
new BinaryMessageDecoder<${this.mangle($schema.getName())}>(MODEL$,
SCHEMA$);
/**
+ * Return the BinaryMessageEncoder instance used by this class.
+ * @return the message encoder used by this class
+ */
+ public static BinaryMessageEncoder<${this.mangle($schema.getName())}>
getEncoder() {
+ return ENCODER;
+ }
+
+ /**
* Return the BinaryMessageDecoder instance used by this class.
* @return the message decoder used by this class
*/
diff --git
a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
index af6e486..531cc6f 100644
---
a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
+++
b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
@@ -28,6 +28,14 @@ public class Player extends
org.apache.avro.specific.SpecificRecordBase implemen
new BinaryMessageDecoder<Player>(MODEL$, SCHEMA$);
/**
+ * Return the BinaryMessageEncoder instance used by this class.
+ * @return the message encoder used by this class
+ */
+ public static BinaryMessageEncoder<Player> getEncoder() {
+ return ENCODER;
+ }
+
+ /**
* Return the BinaryMessageDecoder instance used by this class.
* @return the message decoder used by this class
*/
diff --git a/lang/java/tools/src/test/compiler/output/Player.java
b/lang/java/tools/src/test/compiler/output/Player.java
index 8376389..94fc7d0 100644
--- a/lang/java/tools/src/test/compiler/output/Player.java
+++ b/lang/java/tools/src/test/compiler/output/Player.java
@@ -28,6 +28,14 @@ public class Player extends
org.apache.avro.specific.SpecificRecordBase implemen
new BinaryMessageDecoder<Player>(MODEL$, SCHEMA$);
/**
+ * Return the BinaryMessageEncoder instance used by this class.
+ * @return the message encoder used by this class
+ */
+ public static BinaryMessageEncoder<Player> getEncoder() {
+ return ENCODER;
+ }
+
+ /**
* Return the BinaryMessageDecoder instance used by this class.
* @return the message decoder used by this class
*/