/** * 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 java.nio.ByteBuffer; @SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated public class TestRecordWithoutLogicalTypes 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\":\"TestRecordWithoutLogicalTypes\",\"namespace\":\"org.apache.avro.specific\",\"fields\":[{\"name\":\"b\",\"type\":\"boolean\"},{\"name\":\"i32\",\"type\":\"int\"},{\"name\":\"i64\",\"type\":\"long\"},{\"name\":\"f32\",\"type\":\"float\"},{\"name\":\"f64\",\"type\":\"double\"},{\"name\":\"s\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"d\",\"type\":{\"type\":\"int\",\"logicalType\":\"date\"}},{\"name\":\"t\",\"type\":{\"type\":\"int\",\"logicalType\":\"time-millis\"}},{\"name\":\"ts\",\"type\":{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}},{\"name\":\"dec\",\"type\":{\"type\":\"bytes\",\"logicalType\":\"decimal\",\"precision\":9,\"scale\":2}}]}"); public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } private static SpecificData MODEL$ = new SpecificData(); private static final BinaryMessageEncoder<TestRecordWithoutLogicalTypes> ENCODER = new BinaryMessageEncoder<TestRecordWithoutLogicalTypes>(MODEL$, SCHEMA$); private static final BinaryMessageDecoder<TestRecordWithoutLogicalTypes> DECODER = new BinaryMessageDecoder<TestRecordWithoutLogicalTypes>(MODEL$, SCHEMA$); /** Serializes this ${schema.getName()} to a ByteBuffer. */ public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { return ENCODER.encode(this); } /** Deserializes a ${schema.getName()} from a ByteBuffer. */ public static TestRecordWithoutLogicalTypes fromByteBuffer( java.nio.ByteBuffer b) throws java.io.IOException { return DECODER.decode(b); } private boolean b; private int i32; private long i64; private float f32; private double f64; private java.lang.String s; private int d; private int t; private long ts; private ByteBuffer dec; /** * Default constructor. Note that this does not initialize fields * to their default values from the schema. If that is desired then * one should use {@link \#newBuilder()}. */ public TestRecordWithoutLogicalTypes() {} /** * All-args constructor. */ public TestRecordWithoutLogicalTypes(java.lang.Boolean b, java.lang.Integer i32, java.lang.Long i64, java.lang.Float f32, java.lang.Double f64, java.lang.String s, java.lang.Integer d, java.lang.Integer t, java.lang.Long ts, java.nio.ByteBuffer dec) { this.b = b; this.i32 = i32; this.i64 = i64; this.f32 = f32; this.f64 = f64; this.s = s; this.d = d; this.t = t; this.ts = ts; this.dec = dec; } public org.apache.avro.Schema getSchema() { return SCHEMA$; } // Used by DatumWriter. Applications should not call. public java.lang.Object get(int field$) { switch (field$) { case 0: return b; case 1: return i32; case 2: return i64; case 3: return f32; case 4: return f64; case 5: return s; case 6: return d; case 7: return t; case 8: return ts; case 9: return dec; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } // Used by DatumReader. Applications should not call. @SuppressWarnings(value="unchecked") public void put(int field$, java.lang.Object value$) { switch (field$) { case 0: b = (java.lang.Boolean)value$; break; case 1: i32 = (java.lang.Integer)value$; break; case 2: i64 = (java.lang.Long)value$; break; case 3: f32 = (java.lang.Float)value$; break; case 4: f64 = (java.lang.Double)value$; break; case 5: s = (java.lang.String)value$; break; case 6: d = (java.lang.Integer)value$; break; case 7: t = (java.lang.Integer)value$; break; case 8: ts = (java.lang.Long)value$; break; case 9: dec = (java.nio.ByteBuffer) value$; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** * Gets the value of the 'b' field. */ public java.lang.Boolean getB() { return b; } /** * Gets the value of the 'i32' field. */ public java.lang.Integer getI32() { return i32; } /** * Gets the value of the 'i64' field. */ public java.lang.Long getI64() { return i64; } /** * Gets the value of the 'f32' field. */ public java.lang.Float getF32() { return f32; } /** * Gets the value of the 'f64' field. */ public java.lang.Double getF64() { return f64; } /** * Gets the value of the 's' field. */ public java.lang.String getS() { return s; } /** * Gets the value of the 'd' field. */ public java.lang.Integer getD() { return d; } /** * Gets the value of the 't' field. */ public java.lang.Integer getT() { return t; } /** * Gets the value of the 'ts' field. */ public java.lang.Long getTs() { return ts; } /** * Gets the value of the 'ts' field. */ public java.nio.ByteBuffer getDec() { return dec; } /** Creates a new TestRecordWithoutLogicalTypes RecordBuilder */ public static TestRecordWithoutLogicalTypes.Builder newBuilder() { return new TestRecordWithoutLogicalTypes.Builder(); } /** Creates a new TestRecordWithoutLogicalTypes RecordBuilder by copying an existing Builder */ public static TestRecordWithoutLogicalTypes.Builder newBuilder(TestRecordWithoutLogicalTypes.Builder other) { return new TestRecordWithoutLogicalTypes.Builder(other); } /** Creates a new TestRecordWithoutLogicalTypes RecordBuilder by copying an existing TestRecordWithoutLogicalTypes instance */ public static TestRecordWithoutLogicalTypes.Builder newBuilder(TestRecordWithoutLogicalTypes other) { return new TestRecordWithoutLogicalTypes.Builder(other); } /** * RecordBuilder for TestRecordWithoutLogicalTypes instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<TestRecordWithoutLogicalTypes> implements org.apache.avro.data.RecordBuilder<TestRecordWithoutLogicalTypes> { private boolean b; private int i32; private long i64; private float f32; private double f64; private java.lang.String s; private int d; private int t; private long ts; private ByteBuffer dec; /** Creates a new Builder */ private Builder() { super(TestRecordWithoutLogicalTypes.SCHEMA$); } /** Creates a Builder by copying an existing Builder */ private Builder(TestRecordWithoutLogicalTypes.Builder other) { super(other); if (isValidValue(fields()[0], other.b)) { this.b = data().deepCopy(fields()[0].schema(), other.b); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.i32)) { this.i32 = data().deepCopy(fields()[1].schema(), other.i32); fieldSetFlags()[1] = true; } if (isValidValue(fields()[2], other.i64)) { this.i64 = data().deepCopy(fields()[2].schema(), other.i64); fieldSetFlags()[2] = true; } if (isValidValue(fields()[3], other.f32)) { this.f32 = data().deepCopy(fields()[3].schema(), other.f32); fieldSetFlags()[3] = true; } if (isValidValue(fields()[4], other.f64)) { this.f64 = data().deepCopy(fields()[4].schema(), other.f64); fieldSetFlags()[4] = true; } if (isValidValue(fields()[5], other.s)) { this.s = data().deepCopy(fields()[5].schema(), other.s); fieldSetFlags()[5] = true; } if (isValidValue(fields()[6], other.d)) { this.d = data().deepCopy(fields()[6].schema(), other.d); fieldSetFlags()[6] = true; } if (isValidValue(fields()[7], other.t)) { this.t = data().deepCopy(fields()[7].schema(), other.t); fieldSetFlags()[7] = true; } if (isValidValue(fields()[8], other.ts)) { this.ts = data().deepCopy(fields()[8].schema(), other.ts); fieldSetFlags()[8] = true; } if (isValidValue(fields()[9], other.dec)) { this.dec = data().deepCopy(fields()[9].schema(), other.dec); fieldSetFlags()[9] = true; } } /** Creates a Builder by copying an existing TestRecordWithoutLogicalTypes instance */ private Builder(TestRecordWithoutLogicalTypes other) { super(TestRecordWithoutLogicalTypes.SCHEMA$); if (isValidValue(fields()[0], other.b)) { this.b = data().deepCopy(fields()[0].schema(), other.b); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.i32)) { this.i32 = data().deepCopy(fields()[1].schema(), other.i32); fieldSetFlags()[1] = true; } if (isValidValue(fields()[2], other.i64)) { this.i64 = data().deepCopy(fields()[2].schema(), other.i64); fieldSetFlags()[2] = true; } if (isValidValue(fields()[3], other.f32)) { this.f32 = data().deepCopy(fields()[3].schema(), other.f32); fieldSetFlags()[3] = true; } if (isValidValue(fields()[4], other.f64)) { this.f64 = data().deepCopy(fields()[4].schema(), other.f64); fieldSetFlags()[4] = true; } if (isValidValue(fields()[5], other.s)) { this.s = data().deepCopy(fields()[5].schema(), other.s); fieldSetFlags()[5] = true; } if (isValidValue(fields()[6], other.d)) { this.d = data().deepCopy(fields()[6].schema(), other.d); fieldSetFlags()[6] = true; } if (isValidValue(fields()[7], other.t)) { this.t = data().deepCopy(fields()[7].schema(), other.t); fieldSetFlags()[7] = true; } if (isValidValue(fields()[8], other.ts)) { this.ts = data().deepCopy(fields()[8].schema(), other.ts); fieldSetFlags()[8] = true; } if (isValidValue(fields()[9], other.ts)) { this.dec = data().deepCopy(fields()[9].schema(), other.dec); fieldSetFlags()[9] = true; } } /** Gets the value of the 'b' field */ public java.lang.Boolean getB() { return b; } /** Sets the value of the 'b' field */ public TestRecordWithoutLogicalTypes.Builder setB(boolean value) { validate(fields()[0], value); this.b = value; fieldSetFlags()[0] = true; return this; } /** Checks whether the 'b' field has been set */ public boolean hasB() { return fieldSetFlags()[0]; } /** Clears the value of the 'b' field */ public TestRecordWithoutLogicalTypes.Builder clearB() { fieldSetFlags()[0] = false; return this; } /** Gets the value of the 'i32' field */ public java.lang.Integer getI32() { return i32; } /** Sets the value of the 'i32' field */ public TestRecordWithoutLogicalTypes.Builder setI32(int value) { validate(fields()[1], value); this.i32 = value; fieldSetFlags()[1] = true; return this; } /** Checks whether the 'i32' field has been set */ public boolean hasI32() { return fieldSetFlags()[1]; } /** Clears the value of the 'i32' field */ public TestRecordWithoutLogicalTypes.Builder clearI32() { fieldSetFlags()[1] = false; return this; } /** Gets the value of the 'i64' field */ public java.lang.Long getI64() { return i64; } /** Sets the value of the 'i64' field */ public TestRecordWithoutLogicalTypes.Builder setI64(long value) { validate(fields()[2], value); this.i64 = value; fieldSetFlags()[2] = true; return this; } /** Checks whether the 'i64' field has been set */ public boolean hasI64() { return fieldSetFlags()[2]; } /** Clears the value of the 'i64' field */ public TestRecordWithoutLogicalTypes.Builder clearI64() { fieldSetFlags()[2] = false; return this; } /** Gets the value of the 'f32' field */ public java.lang.Float getF32() { return f32; } /** Sets the value of the 'f32' field */ public TestRecordWithoutLogicalTypes.Builder setF32(float value) { validate(fields()[3], value); this.f32 = value; fieldSetFlags()[3] = true; return this; } /** Checks whether the 'f32' field has been set */ public boolean hasF32() { return fieldSetFlags()[3]; } /** Clears the value of the 'f32' field */ public TestRecordWithoutLogicalTypes.Builder clearF32() { fieldSetFlags()[3] = false; return this; } /** Gets the value of the 'f64' field */ public java.lang.Double getF64() { return f64; } /** Sets the value of the 'f64' field */ public TestRecordWithoutLogicalTypes.Builder setF64(double value) { validate(fields()[4], value); this.f64 = value; fieldSetFlags()[4] = true; return this; } /** Checks whether the 'f64' field has been set */ public boolean hasF64() { return fieldSetFlags()[4]; } /** Clears the value of the 'f64' field */ public TestRecordWithoutLogicalTypes.Builder clearF64() { fieldSetFlags()[4] = false; return this; } /** Gets the value of the 's' field */ public java.lang.String getS() { return s; } /** Sets the value of the 's' field */ public TestRecordWithoutLogicalTypes.Builder setS(java.lang.String value) { validate(fields()[5], value); this.s = value; fieldSetFlags()[5] = true; return this; } /** Checks whether the 's' field has been set */ public boolean hasS() { return fieldSetFlags()[5]; } /** Clears the value of the 's' field */ public TestRecordWithoutLogicalTypes.Builder clearS() { s = null; fieldSetFlags()[5] = false; return this; } /** Gets the value of the 'd' field */ public java.lang.Integer getD() { return d; } /** Sets the value of the 'd' field */ public TestRecordWithoutLogicalTypes.Builder setD(int value) { validate(fields()[6], value); this.d = value; fieldSetFlags()[6] = true; return this; } /** Checks whether the 'd' field has been set */ public boolean hasD() { return fieldSetFlags()[6]; } /** Clears the value of the 'd' field */ public TestRecordWithoutLogicalTypes.Builder clearD() { fieldSetFlags()[6] = false; return this; } /** Gets the value of the 't' field */ public java.lang.Integer getT() { return t; } /** Sets the value of the 't' field */ public TestRecordWithoutLogicalTypes.Builder setT(int value) { validate(fields()[7], value); this.t = value; fieldSetFlags()[7] = true; return this; } /** Checks whether the 't' field has been set */ public boolean hasT() { return fieldSetFlags()[7]; } /** Clears the value of the 't' field */ public TestRecordWithoutLogicalTypes.Builder clearT() { fieldSetFlags()[7] = false; return this; } /** Gets the value of the 'ts' field */ public java.lang.Long getTs() { return ts; } /** Sets the value of the 'ts' field */ public TestRecordWithoutLogicalTypes.Builder setTs(long value) { validate(fields()[8], value); this.ts = value; fieldSetFlags()[8] = true; return this; } /** Checks whether the 'ts' field has been set */ public boolean hasTs() { return fieldSetFlags()[8]; } /** Clears the value of the 'ts' field */ public TestRecordWithoutLogicalTypes.Builder clearTs() { fieldSetFlags()[8] = false; return this; } /** Gedec the value of the 'dec' field */ public java.nio.ByteBuffer getDec() { return dec; } /** Sedec the value of the 'dec' field */ public TestRecordWithoutLogicalTypes.Builder setDec(java.nio.ByteBuffer value) { validate(fields()[9], value); this.dec = value; fieldSetFlags()[9] = true; return this; } /** Checks whether the 'dec' field has been set */ public boolean hasDec() { return fieldSetFlags()[9]; } /** Clears the value of the 'dec' field */ public TestRecordWithoutLogicalTypes.Builder clearDec() { fieldSetFlags()[9] = false; return this; } @Override public TestRecordWithoutLogicalTypes build() { try { TestRecordWithoutLogicalTypes record = new TestRecordWithoutLogicalTypes(); record.b = fieldSetFlags()[0] ? this.b : (java.lang.Boolean) defaultValue(fields()[0]); record.i32 = fieldSetFlags()[1] ? this.i32 : (java.lang.Integer) defaultValue(fields()[1]); record.i64 = fieldSetFlags()[2] ? this.i64 : (java.lang.Long) defaultValue(fields()[2]); record.f32 = fieldSetFlags()[3] ? this.f32 : (java.lang.Float) defaultValue(fields()[3]); record.f64 = fieldSetFlags()[4] ? this.f64 : (java.lang.Double) defaultValue(fields()[4]); record.s = fieldSetFlags()[5] ? this.s : (java.lang.String) defaultValue(fields()[5]); record.d = fieldSetFlags()[6] ? this.d : (java.lang.Integer) defaultValue(fields()[6]); record.t = fieldSetFlags()[7] ? this.t : (java.lang.Integer) defaultValue(fields()[7]); record.ts = fieldSetFlags()[8] ? this.ts : (java.lang.Long) defaultValue(fields()[8]); record.dec = fieldSetFlags()[9] ? this.dec : (java.nio.ByteBuffer) defaultValue(fields()[9]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } }