/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.apache.spark.sql.execution.datasources.parquet.test.avro;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class AvroPrimitives 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\":\"AvroPrimitives\",\"namespace\":\"org.apache.spark.sql.execution.datasources.parquet.test.avro\",\"fields\":[{\"name\":\"bool_column\",\"type\":\"boolean\"},{\"name\":\"int_column\",\"type\":\"int\"},{\"name\":\"long_column\",\"type\":\"long\"},{\"name\":\"float_column\",\"type\":\"float\"},{\"name\":\"double_column\",\"type\":\"double\"},{\"name\":\"binary_column\",\"type\":\"bytes\"},{\"name\":\"string_column\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public boolean bool_column;
  @Deprecated public int int_column;
  @Deprecated public long long_column;
  @Deprecated public float float_column;
  @Deprecated public double double_column;
  @Deprecated public java.nio.ByteBuffer binary_column;
  @Deprecated public java.lang.String string_column;

  /**
   * 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 AvroPrimitives() {}

  /**
   * All-args constructor.
   */
  public AvroPrimitives(java.lang.Boolean bool_column, java.lang.Integer int_column, java.lang.Long long_column, java.lang.Float float_column, java.lang.Double double_column, java.nio.ByteBuffer binary_column, java.lang.String string_column) {
    this.bool_column = bool_column;
    this.int_column = int_column;
    this.long_column = long_column;
    this.float_column = float_column;
    this.double_column = double_column;
    this.binary_column = binary_column;
    this.string_column = string_column;
  }

  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 bool_column;
    case 1: return int_column;
    case 2: return long_column;
    case 3: return float_column;
    case 4: return double_column;
    case 5: return binary_column;
    case 6: return string_column;
    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: bool_column = (java.lang.Boolean)value$; break;
    case 1: int_column = (java.lang.Integer)value$; break;
    case 2: long_column = (java.lang.Long)value$; break;
    case 3: float_column = (java.lang.Float)value$; break;
    case 4: double_column = (java.lang.Double)value$; break;
    case 5: binary_column = (java.nio.ByteBuffer)value$; break;
    case 6: string_column = (java.lang.String)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'bool_column' field.
   */
  public java.lang.Boolean getBoolColumn() {
    return bool_column;
  }

  /**
   * Sets the value of the 'bool_column' field.
   * @param value the value to set.
   */
  public void setBoolColumn(java.lang.Boolean value) {
    this.bool_column = value;
  }

  /**
   * Gets the value of the 'int_column' field.
   */
  public java.lang.Integer getIntColumn() {
    return int_column;
  }

  /**
   * Sets the value of the 'int_column' field.
   * @param value the value to set.
   */
  public void setIntColumn(java.lang.Integer value) {
    this.int_column = value;
  }

  /**
   * Gets the value of the 'long_column' field.
   */
  public java.lang.Long getLongColumn() {
    return long_column;
  }

  /**
   * Sets the value of the 'long_column' field.
   * @param value the value to set.
   */
  public void setLongColumn(java.lang.Long value) {
    this.long_column = value;
  }

  /**
   * Gets the value of the 'float_column' field.
   */
  public java.lang.Float getFloatColumn() {
    return float_column;
  }

  /**
   * Sets the value of the 'float_column' field.
   * @param value the value to set.
   */
  public void setFloatColumn(java.lang.Float value) {
    this.float_column = value;
  }

  /**
   * Gets the value of the 'double_column' field.
   */
  public java.lang.Double getDoubleColumn() {
    return double_column;
  }

  /**
   * Sets the value of the 'double_column' field.
   * @param value the value to set.
   */
  public void setDoubleColumn(java.lang.Double value) {
    this.double_column = value;
  }

  /**
   * Gets the value of the 'binary_column' field.
   */
  public java.nio.ByteBuffer getBinaryColumn() {
    return binary_column;
  }

  /**
   * Sets the value of the 'binary_column' field.
   * @param value the value to set.
   */
  public void setBinaryColumn(java.nio.ByteBuffer value) {
    this.binary_column = value;
  }

  /**
   * Gets the value of the 'string_column' field.
   */
  public java.lang.String getStringColumn() {
    return string_column;
  }

  /**
   * Sets the value of the 'string_column' field.
   * @param value the value to set.
   */
  public void setStringColumn(java.lang.String value) {
    this.string_column = value;
  }

  /** Creates a new AvroPrimitives RecordBuilder */
  public static org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder newBuilder() {
    return new org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder();
  }
  
  /** Creates a new AvroPrimitives RecordBuilder by copying an existing Builder */
  public static org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder newBuilder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder other) {
    return new org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder(other);
  }
  
  /** Creates a new AvroPrimitives RecordBuilder by copying an existing AvroPrimitives instance */
  public static org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder newBuilder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives other) {
    return new org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder(other);
  }
  
  /**
   * RecordBuilder for AvroPrimitives instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroPrimitives>
    implements org.apache.avro.data.RecordBuilder<AvroPrimitives> {

    private boolean bool_column;
    private int int_column;
    private long long_column;
    private float float_column;
    private double double_column;
    private java.nio.ByteBuffer binary_column;
    private java.lang.String string_column;

    /** Creates a new Builder */
    private Builder() {
      super(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.bool_column)) {
        this.bool_column = data().deepCopy(fields()[0].schema(), other.bool_column);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.int_column)) {
        this.int_column = data().deepCopy(fields()[1].schema(), other.int_column);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.long_column)) {
        this.long_column = data().deepCopy(fields()[2].schema(), other.long_column);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.float_column)) {
        this.float_column = data().deepCopy(fields()[3].schema(), other.float_column);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.double_column)) {
        this.double_column = data().deepCopy(fields()[4].schema(), other.double_column);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.binary_column)) {
        this.binary_column = data().deepCopy(fields()[5].schema(), other.binary_column);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.string_column)) {
        this.string_column = data().deepCopy(fields()[6].schema(), other.string_column);
        fieldSetFlags()[6] = true;
      }
    }
    
    /** Creates a Builder by copying an existing AvroPrimitives instance */
    private Builder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives other) {
            super(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.SCHEMA$);
      if (isValidValue(fields()[0], other.bool_column)) {
        this.bool_column = data().deepCopy(fields()[0].schema(), other.bool_column);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.int_column)) {
        this.int_column = data().deepCopy(fields()[1].schema(), other.int_column);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.long_column)) {
        this.long_column = data().deepCopy(fields()[2].schema(), other.long_column);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.float_column)) {
        this.float_column = data().deepCopy(fields()[3].schema(), other.float_column);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.double_column)) {
        this.double_column = data().deepCopy(fields()[4].schema(), other.double_column);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.binary_column)) {
        this.binary_column = data().deepCopy(fields()[5].schema(), other.binary_column);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.string_column)) {
        this.string_column = data().deepCopy(fields()[6].schema(), other.string_column);
        fieldSetFlags()[6] = true;
      }
    }

    /** Gets the value of the 'bool_column' field */
    public java.lang.Boolean getBoolColumn() {
      return bool_column;
    }
    
    /** Sets the value of the 'bool_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder setBoolColumn(boolean value) {
      validate(fields()[0], value);
      this.bool_column = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'bool_column' field has been set */
    public boolean hasBoolColumn() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'bool_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder clearBoolColumn() {
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'int_column' field */
    public java.lang.Integer getIntColumn() {
      return int_column;
    }
    
    /** Sets the value of the 'int_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder setIntColumn(int value) {
      validate(fields()[1], value);
      this.int_column = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'int_column' field has been set */
    public boolean hasIntColumn() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'int_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder clearIntColumn() {
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'long_column' field */
    public java.lang.Long getLongColumn() {
      return long_column;
    }
    
    /** Sets the value of the 'long_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder setLongColumn(long value) {
      validate(fields()[2], value);
      this.long_column = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'long_column' field has been set */
    public boolean hasLongColumn() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'long_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder clearLongColumn() {
      fieldSetFlags()[2] = false;
      return this;
    }

    /** Gets the value of the 'float_column' field */
    public java.lang.Float getFloatColumn() {
      return float_column;
    }
    
    /** Sets the value of the 'float_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder setFloatColumn(float value) {
      validate(fields()[3], value);
      this.float_column = value;
      fieldSetFlags()[3] = true;
      return this; 
    }
    
    /** Checks whether the 'float_column' field has been set */
    public boolean hasFloatColumn() {
      return fieldSetFlags()[3];
    }
    
    /** Clears the value of the 'float_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder clearFloatColumn() {
      fieldSetFlags()[3] = false;
      return this;
    }

    /** Gets the value of the 'double_column' field */
    public java.lang.Double getDoubleColumn() {
      return double_column;
    }
    
    /** Sets the value of the 'double_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder setDoubleColumn(double value) {
      validate(fields()[4], value);
      this.double_column = value;
      fieldSetFlags()[4] = true;
      return this; 
    }
    
    /** Checks whether the 'double_column' field has been set */
    public boolean hasDoubleColumn() {
      return fieldSetFlags()[4];
    }
    
    /** Clears the value of the 'double_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder clearDoubleColumn() {
      fieldSetFlags()[4] = false;
      return this;
    }

    /** Gets the value of the 'binary_column' field */
    public java.nio.ByteBuffer getBinaryColumn() {
      return binary_column;
    }
    
    /** Sets the value of the 'binary_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder setBinaryColumn(java.nio.ByteBuffer value) {
      validate(fields()[5], value);
      this.binary_column = value;
      fieldSetFlags()[5] = true;
      return this; 
    }
    
    /** Checks whether the 'binary_column' field has been set */
    public boolean hasBinaryColumn() {
      return fieldSetFlags()[5];
    }
    
    /** Clears the value of the 'binary_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder clearBinaryColumn() {
      binary_column = null;
      fieldSetFlags()[5] = false;
      return this;
    }

    /** Gets the value of the 'string_column' field */
    public java.lang.String getStringColumn() {
      return string_column;
    }
    
    /** Sets the value of the 'string_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder setStringColumn(java.lang.String value) {
      validate(fields()[6], value);
      this.string_column = value;
      fieldSetFlags()[6] = true;
      return this; 
    }
    
    /** Checks whether the 'string_column' field has been set */
    public boolean hasStringColumn() {
      return fieldSetFlags()[6];
    }
    
    /** Clears the value of the 'string_column' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroPrimitives.Builder clearStringColumn() {
      string_column = null;
      fieldSetFlags()[6] = false;
      return this;
    }

    @Override
    public AvroPrimitives build() {
      try {
        AvroPrimitives record = new AvroPrimitives();
        record.bool_column = fieldSetFlags()[0] ? this.bool_column : (java.lang.Boolean) defaultValue(fields()[0]);
        record.int_column = fieldSetFlags()[1] ? this.int_column : (java.lang.Integer) defaultValue(fields()[1]);
        record.long_column = fieldSetFlags()[2] ? this.long_column : (java.lang.Long) defaultValue(fields()[2]);
        record.float_column = fieldSetFlags()[3] ? this.float_column : (java.lang.Float) defaultValue(fields()[3]);
        record.double_column = fieldSetFlags()[4] ? this.double_column : (java.lang.Double) defaultValue(fields()[4]);
        record.binary_column = fieldSetFlags()[5] ? this.binary_column : (java.nio.ByteBuffer) defaultValue(fields()[5]);
        record.string_column = fieldSetFlags()[6] ? this.string_column : (java.lang.String) defaultValue(fields()[6]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}
