/** * Autogenerated by Avro * * DO NOT EDIT DIRECTLY */ package avro.complex_schema; @SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated public class fixed 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\":\"fixed\",\"namespace\":\"avro.complex_schema\",\"fields\":[{\"name\":\"fixed\",\"type\":{\"type\":\"bytes\",\"logicalType\":\"decimal\",\"scale\":0,\"precision\":34},\"doc\":\"Simple type {http://www.w3.org/2001/XMLSchema}decimal\"}]}"); public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } /** Simple type {http://www.w3.org/2001/XMLSchema}decimal */ @Deprecated public java.nio.ByteBuffer fixed; /** * 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 fixed() {} /** * All-args constructor. */ public fixed(java.nio.ByteBuffer fixed) { this.fixed = fixed; } 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 fixed; 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: fixed = (java.nio.ByteBuffer)value$; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** * Gets the value of the 'fixed' field. * Simple type {http://www.w3.org/2001/XMLSchema}decimal */ public java.nio.ByteBuffer getFixed() { return fixed; } /** * Sets the value of the 'fixed' field. * Simple type {http://www.w3.org/2001/XMLSchema}decimal * @param value the value to set. */ public void setFixed(java.nio.ByteBuffer value) { this.fixed = value; } /** Creates a new fixed RecordBuilder */ public static avro.complex_schema.fixed.Builder newBuilder() { return new avro.complex_schema.fixed.Builder(); } /** Creates a new fixed RecordBuilder by copying an existing Builder */ public static avro.complex_schema.fixed.Builder newBuilder(avro.complex_schema.fixed.Builder other) { return new avro.complex_schema.fixed.Builder(other); } /** Creates a new fixed RecordBuilder by copying an existing fixed instance */ public static avro.complex_schema.fixed.Builder newBuilder(avro.complex_schema.fixed other) { return new avro.complex_schema.fixed.Builder(other); } /** * RecordBuilder for fixed instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<fixed> implements org.apache.avro.data.RecordBuilder<fixed> { private java.nio.ByteBuffer fixed; /** Creates a new Builder */ private Builder() { super(avro.complex_schema.fixed.SCHEMA$); } /** Creates a Builder by copying an existing Builder */ private Builder(avro.complex_schema.fixed.Builder other) { super(other); if (isValidValue(fields()[0], other.fixed)) { this.fixed = data().deepCopy(fields()[0].schema(), other.fixed); fieldSetFlags()[0] = true; } } /** Creates a Builder by copying an existing fixed instance */ private Builder(avro.complex_schema.fixed other) { super(avro.complex_schema.fixed.SCHEMA$); if (isValidValue(fields()[0], other.fixed)) { this.fixed = data().deepCopy(fields()[0].schema(), other.fixed); fieldSetFlags()[0] = true; } } /** Gets the value of the 'fixed' field */ public java.nio.ByteBuffer getFixed() { return fixed; } /** Sets the value of the 'fixed' field */ public avro.complex_schema.fixed.Builder setFixed(java.nio.ByteBuffer value) { validate(fields()[0], value); this.fixed = value; fieldSetFlags()[0] = true; return this; } /** Checks whether the 'fixed' field has been set */ public boolean hasFixed() { return fieldSetFlags()[0]; } /** Clears the value of the 'fixed' field */ public avro.complex_schema.fixed.Builder clearFixed() { fixed = null; fieldSetFlags()[0] = false; return this; } @Override public fixed build() { try { fixed record = new fixed(); record.fixed = fieldSetFlags()[0] ? this.fixed : (java.nio.ByteBuffer) defaultValue(fields()[0]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } }