KalleOlaviNiemitalo commented on code in PR #1721:
URL: https://github.com/apache/avro/pull/1721#discussion_r910983116
##########
lang/java/avro/src/test/java/org/apache/avro/specific/TestUnionRecord.java:
##########
@@ -0,0 +1,306 @@
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package org.apache.avro.specific;
+
+import org.apache.avro.message.BinaryMessageDecoder;
+import org.apache.avro.message.BinaryMessageEncoder;
+import org.apache.avro.message.SchemaStore;
+
+@AvroGenerated
+public class TestUnionRecord extends SpecificRecordBase implements
SpecificRecord {
+ private static final long serialVersionUID = -3829374192747523457L;
+
+ public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse(
+
"{\"type\":\"record\",\"name\":\"TestUnionRecord\",\"namespace\":\"org.apache.avro.specific\",\"fields\":[{\"name\":\"amount\",\"type\":[\"null\",{\"type\":\"bytes\",\"logicalType\":\"decimal\",\"precision\":31,\"scale\":8}],\"default\":null}]}");
+
+ public static org.apache.avro.Schema getClassSchema() {
+ return SCHEMA$;
+ }
+
+ private static final SpecificData MODEL$ = new SpecificData();
+ static {
+ MODEL$.addLogicalTypeConversion(new
org.apache.avro.Conversions.DecimalConversion());
+ }
+
+ private static final BinaryMessageEncoder<TestUnionRecord> ENCODER = new
BinaryMessageEncoder<TestUnionRecord>(MODEL$,
+ SCHEMA$);
+
+ private static final BinaryMessageDecoder<TestUnionRecord> DECODER = new
BinaryMessageDecoder<TestUnionRecord>(MODEL$,
+ SCHEMA$);
+
+ /**
+ * Return the BinaryMessageEncoder instance used by this class.
+ *
+ * @return the message encoder used by this class
+ */
+ public static BinaryMessageEncoder<TestUnionRecord> getEncoder() {
+ return ENCODER;
+ }
+
+ /**
+ * Return the BinaryMessageDecoder instance used by this class.
+ *
+ * @return the message decoder used by this class
+ */
+ public static BinaryMessageDecoder<TestUnionRecord> getDecoder() {
+ return DECODER;
+ }
+
+ /**
+ * Create a new BinaryMessageDecoder instance for this class that uses the
+ * specified {@link SchemaStore}.
+ *
+ * @param resolver a {@link SchemaStore} used to find schemas by fingerprint
+ * @return a BinaryMessageDecoder instance for this class backed by the given
+ * SchemaStore
+ */
+ public static BinaryMessageDecoder<TestUnionRecord>
createDecoder(SchemaStore resolver) {
+ return new BinaryMessageDecoder<TestUnionRecord>(MODEL$, SCHEMA$,
resolver);
+ }
+
+ /**
+ * Serializes this TestUnionRecord to a ByteBuffer.
+ *
+ * @return a buffer holding the serialized data for this instance
+ * @throws java.io.IOException if this instance could not be serialized
+ */
+ public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
+ return ENCODER.encode(this);
+ }
+
+ /**
+ * Deserializes a TestUnionRecord from a ByteBuffer.
+ *
+ * @param b a byte buffer holding serialized data for an instance of this
class
+ * @return a TestUnionRecord instance decoded from the given buffer
+ * @throws java.io.IOException if the given bytes could not be deserialized
into
+ * an instance of this class
+ */
+ public static TestUnionRecord fromByteBuffer(java.nio.ByteBuffer b) throws
java.io.IOException {
+ return DECODER.decode(b);
+ }
+
+ private java.math.BigDecimal amount;
+
+ /**
+ * Default constructor. Note that this does not initialize fields to their
+ * default values from the schema. If that is desired then one should use
+ * <code>newBuilder()</code>.
+ */
+ public TestUnionRecord() {
+ }
+
+ /**
+ * All-args constructor.
+ *
+ * @param amount The new value for amount
+ */
+ public TestUnionRecord(java.math.BigDecimal amount) {
+ this.amount = amount;
+ }
+
+ public SpecificData getSpecificData() {
Review Comment:
I meant, if the code generator outputs code that causes warnings about
missing annotations, then it would be good to file an issue about that and fix
it in a separate pull request. But the issue has already been filed so there's
no need to do anything more here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]