/** * Autogenerated by Avro * * DO NOT EDIT DIRECTLY */ package com.manning.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\":\"com.manning.hip.ch3.avro.gen\",\"fields\":[{\"name\":\"symbol\",\"type\":\"string\"},{\"name\":\"avg\",\"type\":\"double\"}]}"); @Deprecated public java.lang.CharSequence symbol; @Deprecated public double avg; 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 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$, java.lang.Object value$) { switch (field$) { case 0: symbol = (java.lang.CharSequence)value$; break; case 1: avg = (java.lang.Double)value$; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** * Gets the value of the 'symbol' field. */ public java.lang.CharSequence getSymbol() { return symbol; } /** * Sets the value of the 'symbol' field. * @param value the value to set. */ public void setSymbol(java.lang.CharSequence value) { this.symbol = value; } /** * Gets the value of the 'avg' field. */ public java.lang.Double getAvg() { return avg; } /** * Sets the value of the 'avg' field. * @param value the value to set. */ public void setAvg(java.lang.Double value) { this.avg = value; } /** Creates a new StockAvg RecordBuilder */ public static com.manning.hip.ch3.avro.gen.StockAvg.Builder newBuilder() { return new com.manning.hip.ch3.avro.gen.StockAvg.Builder(); } /** Creates a new StockAvg RecordBuilder by copying an existing Builder */ public static com.manning.hip.ch3.avro.gen.StockAvg.Builder newBuilder(com.manning.hip.ch3.avro.gen.StockAvg.Builder other) { return new com.manning.hip.ch3.avro.gen.StockAvg.Builder(other); } /** Creates a new StockAvg RecordBuilder by copying an existing StockAvg instance */ public static com.manning.hip.ch3.avro.gen.StockAvg.Builder newBuilder(com.manning.hip.ch3.avro.gen.StockAvg other) { return new com.manning.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 java.lang.CharSequence symbol; private double avg; /** Creates a new Builder */ private Builder() { super(com.manning.hip.ch3.avro.gen.StockAvg.SCHEMA$); } /** Creates a Builder by copying an existing Builder */ private Builder(com.manning.hip.ch3.avro.gen.StockAvg.Builder other) { super(other); } /** Creates a Builder by copying an existing StockAvg instance */ private Builder(com.manning.hip.ch3.avro.gen.StockAvg other) { super(com.manning.hip.ch3.avro.gen.StockAvg.SCHEMA$); if (isValidValue(fields()[0], other.symbol)) { this.symbol = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.symbol); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.avg)) { this.avg = (java.lang.Double) data().deepCopy(fields()[1].schema(), other.avg); fieldSetFlags()[1] = true; } } /** Gets the value of the 'symbol' field */ public java.lang.CharSequence getSymbol() { return symbol; } /** Sets the value of the 'symbol' field */ public com.manning.hip.ch3.avro.gen.StockAvg.Builder setSymbol(java.lang.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 com.manning.hip.ch3.avro.gen.StockAvg.Builder clearSymbol() { symbol = null; fieldSetFlags()[0] = false; return this; } /** Gets the value of the 'avg' field */ public java.lang.Double getAvg() { return avg; } /** Sets the value of the 'avg' field */ public com.manning.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 com.manning.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 : (java.lang.CharSequence) defaultValue(fields()[0]); record.avg = fieldSetFlags()[1] ? this.avg : (java.lang.Double) defaultValue(fields()[1]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } }