/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.apache.avro;  
@SuppressWarnings("all")
public class FooBarSpecificRecord 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\":\"FooBarSpecificRecord\",\"namespace\":\"org.apache.avro\",\"fields\":[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"relatedids\",\"type\":{\"type\":\"array\",\"items\":\"int\"}},{\"name\":\"typeEnum\",\"type\":[\"null\",{\"type\":\"enum\",\"name\":\"TypeEnum\",\"symbols\":[\"a\",\"b\",\"c\"]}],\"default\":null}]}");
  @Deprecated public int id;
  @Deprecated public java.util.List<java.lang.Integer> relatedids;
  @Deprecated public org.apache.avro.TypeEnum typeEnum;

  /**
   * Default constructor.
   */
  public FooBarSpecificRecord() {}

  /**
   * All-args constructor.
   */
  public FooBarSpecificRecord(java.lang.Integer id, java.util.List<java.lang.Integer> relatedids, org.apache.avro.TypeEnum typeEnum) {
    this.id = id;
    this.relatedids = relatedids;
    this.typeEnum = typeEnum;
  }

  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 id;
    case 1: return relatedids;
    case 2: return typeEnum;
    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: id = (java.lang.Integer)value$; break;
    case 1: relatedids = (java.util.List<java.lang.Integer>)value$; break;
    case 2: typeEnum = (org.apache.avro.TypeEnum)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

  /**
   * Gets the value of the 'relatedids' field.
   */
  public java.util.List<java.lang.Integer> getRelatedids() {
    return relatedids;
  }

  /**
   * Sets the value of the 'relatedids' field.
   * @param value the value to set.
   */
  public void setRelatedids(java.util.List<java.lang.Integer> value) {
    this.relatedids = value;
  }

  /**
   * Gets the value of the 'typeEnum' field.
   */
  public org.apache.avro.TypeEnum getTypeEnum() {
    return typeEnum;
  }

  /**
   * Sets the value of the 'typeEnum' field.
   * @param value the value to set.
   */
  public void setTypeEnum(org.apache.avro.TypeEnum value) {
    this.typeEnum = value;
  }

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

    private int id;
    private java.util.List<java.lang.Integer> relatedids;
    private org.apache.avro.TypeEnum typeEnum;

    /** Creates a new Builder */
    private Builder() {
      super(org.apache.avro.FooBarSpecificRecord.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.apache.avro.FooBarSpecificRecord.Builder other) {
      super(other);
    }
    
    /** Creates a Builder by copying an existing FooBarSpecificRecord instance */
    private Builder(org.apache.avro.FooBarSpecificRecord other) {
            super(org.apache.avro.FooBarSpecificRecord.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = (java.lang.Integer) data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.relatedids)) {
        this.relatedids = (java.util.List<java.lang.Integer>) data().deepCopy(fields()[1].schema(), other.relatedids);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.typeEnum)) {
        this.typeEnum = (org.apache.avro.TypeEnum) data().deepCopy(fields()[2].schema(), other.typeEnum);
        fieldSetFlags()[2] = true;
    }
    }

    /** Gets the value of the 'id' field */
    public java.lang.Integer getId() {
      return id;
    }
    
    /** Sets the value of the 'id' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setId(int value) {
      validate(fields()[0], value);
      this.id = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'id' field has been set */
    public boolean hasId() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'id' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearId() {
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'relatedids' field */
    public java.util.List<java.lang.Integer> getRelatedids() {
      return relatedids;
    }
    
    /** Sets the value of the 'relatedids' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setRelatedids(java.util.List<java.lang.Integer> value) {
      validate(fields()[1], value);
      this.relatedids = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'relatedids' field has been set */
    public boolean hasRelatedids() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'relatedids' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearRelatedids() {
      relatedids = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'typeEnum' field */
    public org.apache.avro.TypeEnum getTypeEnum() {
      return typeEnum;
    }
    
    /** Sets the value of the 'typeEnum' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setTypeEnum(org.apache.avro.TypeEnum value) {
      validate(fields()[2], value);
      this.typeEnum = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'typeEnum' field has been set */
    public boolean hasTypeEnum() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'typeEnum' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearTypeEnum() {
      typeEnum = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public FooBarSpecificRecord build() {
      try {
        FooBarSpecificRecord record = new FooBarSpecificRecord();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.Integer) defaultValue(fields()[0]);
        record.relatedids = fieldSetFlags()[1] ? this.relatedids : (java.util.List<java.lang.Integer>) defaultValue(fields()[1]);
        record.typeEnum = fieldSetFlags()[2] ? this.typeEnum : (org.apache.avro.TypeEnum) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}
