/** * Autogenerated by Avro * * DO NOT EDIT DIRECTLY */ package hip.ch3.avro.gen; @SuppressWarnings("all") public class StockAvg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"StockAvg\",\"namespace\":\"hip.ch3.avro.gen\",\"fields\":[{\"name\":\"symbol\",\"type\":\"string\"},{\"name\":\"avg\",\"type\":\"double\"}]}"); @Deprecated public CharSequence symbol; @Deprecated public double avg; public org.apache.avro.Schema getSchema() { return SCHEMA$; } // Used by DatumWriter. Applications should not call. public Object get(int field$) { switch (field$) { case 0: return symbol; case 1: return avg; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } // Used by DatumReader. Applications should not call. @SuppressWarnings(value="unchecked") public void put(int field$, Object value$) { switch (field$) { case 0: symbol = (CharSequence)value$; break; case 1: avg = (Double)value$; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** * Gets the value of the 'symbol' field. */ public CharSequence getSymbol() { return symbol; } /** * Sets the value of the 'symbol' field. * @param value the value to set. */ public void setSymbol(CharSequence value) { this.symbol = value; } /** * Gets the value of the 'avg' field. */ public Double getAvg() { return avg; } /** * Sets the value of the 'avg' field. * @param value the value to set. */ public void setAvg(Double value) { this.avg = value; } /** Creates a new StockAvg RecordBuilder */ public static hip.ch3.avro.gen.StockAvg.Builder newBuilder() { return new hip.ch3.avro.gen.StockAvg.Builder(); } /** Creates a new StockAvg RecordBuilder by copying an existing Builder */ public static hip.ch3.avro.gen.StockAvg.Builder newBuilder(hip.ch3.avro.gen.StockAvg.Builder other) { return new hip.ch3.avro.gen.StockAvg.Builder(other); } /** Creates a new StockAvg RecordBuilder by copying an existing StockAvg instance */ public static hip.ch3.avro.gen.StockAvg.Builder newBuilder(hip.ch3.avro.gen.StockAvg other) { return new hip.ch3.avro.gen.StockAvg.Builder(other); } /** * RecordBuilder for StockAvg instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<StockAvg> implements org.apache.avro.data.RecordBuilder<StockAvg> { private CharSequence symbol; private double avg; /** Creates a new Builder */ private Builder() { super(hip.ch3.avro.gen.StockAvg.SCHEMA$); } /** Creates a Builder by copying an existing Builder */ private Builder(hip.ch3.avro.gen.StockAvg.Builder other) { super(other); } /** Creates a Builder by copying an existing StockAvg instance */ private Builder(hip.ch3.avro.gen.StockAvg other) { super(hip.ch3.avro.gen.StockAvg.SCHEMA$); if (isValidValue(fields()[0], other.symbol)) { this.symbol = (CharSequence) data().deepCopy(fields()[0].schema(), other.symbol); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.avg)) { this.avg = (Double) data().deepCopy(fields()[1].schema(), other.avg); fieldSetFlags()[1] = true; } } /** Gets the value of the 'symbol' field */ public CharSequence getSymbol() { return symbol; } /** Sets the value of the 'symbol' field */ public hip.ch3.avro.gen.StockAvg.Builder setSymbol(CharSequence value) { validate(fields()[0], value); this.symbol = value; fieldSetFlags()[0] = true; return this; } /** Checks whether the 'symbol' field has been set */ public boolean hasSymbol() { return fieldSetFlags()[0]; } /** Clears the value of the 'symbol' field */ public hip.ch3.avro.gen.StockAvg.Builder clearSymbol() { symbol = null; fieldSetFlags()[0] = false; return this; } /** Gets the value of the 'avg' field */ public Double getAvg() { return avg; } /** Sets the value of the 'avg' field */ public hip.ch3.avro.gen.StockAvg.Builder setAvg(double value) { validate(fields()[1], value); this.avg = value; fieldSetFlags()[1] = true; return this; } /** Checks whether the 'avg' field has been set */ public boolean hasAvg() { return fieldSetFlags()[1]; } /** Clears the value of the 'avg' field */ public hip.ch3.avro.gen.StockAvg.Builder clearAvg() { fieldSetFlags()[1] = false; return this; } @Override public StockAvg build() { try { StockAvg record = new StockAvg(); record.symbol = fieldSetFlags()[0] ? this.symbol : (CharSequence) defaultValue(fields()[0]); record.avg = fieldSetFlags()[1] ? this.avg : (Double) defaultValue(fields()[1]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } }