/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.apache.hadoop.hive.hbase.avro;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class ContactInfo 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\":\"ContactInfo\",\"namespace\":\"org.apache.hadoop.hive.hbase.avro\",\"fields\":[{\"name\":\"address\",\"type\":[{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"Address\",\"fields\":[{\"name\":\"address1\",\"type\":\"string\"},{\"name\":\"address2\",\"type\":\"string\"},{\"name\":\"city\",\"type\":\"string\"},{\"name\":\"zipcode\",\"type\":\"long\"},{\"name\":\"county\",\"type\":[{\"type\":\"record\",\"name\":\"HomePhone\",\"fields\":[{\"name\":\"areaCode\",\"type\":\"long\"},{\"name\":\"number\",\"type\":\"long\"}]},{\"type\":\"record\",\"name\":\"OfficePhone\",\"fields\":[{\"name\":\"areaCode\",\"type\":\"long\"},{\"name\":\"number\",\"type\":\"long\"}]},\"string\",\"null\"]},{\"name\":\"aliases\",\"type\":[{\"type\":\"array\",\"items\":\"string\"},\"null\"]},{\"name\":\"metadata\",\"type\":[\"null\",{\"type\":\"map\",\"values\":\"string\"}]}]}},\"null\"]},{\"name\":\"homePhone\",\"type\":\"HomePhone\"},{\"name\":\"officePhone\",\"type\":\"OfficePhone\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public java.util.List<org.apache.hadoop.hive.hbase.avro.Address> address;
  @Deprecated public org.apache.hadoop.hive.hbase.avro.HomePhone homePhone;
  @Deprecated public org.apache.hadoop.hive.hbase.avro.OfficePhone officePhone;

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

  /**
   * All-args constructor.
   */
  public ContactInfo(java.util.List<org.apache.hadoop.hive.hbase.avro.Address> address, org.apache.hadoop.hive.hbase.avro.HomePhone homePhone, org.apache.hadoop.hive.hbase.avro.OfficePhone officePhone) {
    this.address = address;
    this.homePhone = homePhone;
    this.officePhone = officePhone;
  }

  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 address;
    case 1: return homePhone;
    case 2: return officePhone;
    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: address = (java.util.List<org.apache.hadoop.hive.hbase.avro.Address>)value$; break;
    case 1: homePhone = (org.apache.hadoop.hive.hbase.avro.HomePhone)value$; break;
    case 2: officePhone = (org.apache.hadoop.hive.hbase.avro.OfficePhone)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'address' field.
   */
  public java.util.List<org.apache.hadoop.hive.hbase.avro.Address> getAddress() {
    return address;
  }

  /**
   * Sets the value of the 'address' field.
   * @param value the value to set.
   */
  public void setAddress(java.util.List<org.apache.hadoop.hive.hbase.avro.Address> value) {
    this.address = value;
  }

  /**
   * Gets the value of the 'homePhone' field.
   */
  public org.apache.hadoop.hive.hbase.avro.HomePhone getHomePhone() {
    return homePhone;
  }

  /**
   * Sets the value of the 'homePhone' field.
   * @param value the value to set.
   */
  public void setHomePhone(org.apache.hadoop.hive.hbase.avro.HomePhone value) {
    this.homePhone = value;
  }

  /**
   * Gets the value of the 'officePhone' field.
   */
  public org.apache.hadoop.hive.hbase.avro.OfficePhone getOfficePhone() {
    return officePhone;
  }

  /**
   * Sets the value of the 'officePhone' field.
   * @param value the value to set.
   */
  public void setOfficePhone(org.apache.hadoop.hive.hbase.avro.OfficePhone value) {
    this.officePhone = value;
  }

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

    private java.util.List<org.apache.hadoop.hive.hbase.avro.Address> address;
    private org.apache.hadoop.hive.hbase.avro.HomePhone homePhone;
    private org.apache.hadoop.hive.hbase.avro.OfficePhone officePhone;

    /** Creates a new Builder */
    private Builder() {
      super(org.apache.hadoop.hive.hbase.avro.ContactInfo.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.apache.hadoop.hive.hbase.avro.ContactInfo.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.address)) {
        this.address = data().deepCopy(fields()[0].schema(), other.address);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.homePhone)) {
        this.homePhone = data().deepCopy(fields()[1].schema(), other.homePhone);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.officePhone)) {
        this.officePhone = data().deepCopy(fields()[2].schema(), other.officePhone);
        fieldSetFlags()[2] = true;
      }
    }
    
    /** Creates a Builder by copying an existing ContactInfo instance */
    private Builder(org.apache.hadoop.hive.hbase.avro.ContactInfo other) {
            super(org.apache.hadoop.hive.hbase.avro.ContactInfo.SCHEMA$);
      if (isValidValue(fields()[0], other.address)) {
        this.address = data().deepCopy(fields()[0].schema(), other.address);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.homePhone)) {
        this.homePhone = data().deepCopy(fields()[1].schema(), other.homePhone);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.officePhone)) {
        this.officePhone = data().deepCopy(fields()[2].schema(), other.officePhone);
        fieldSetFlags()[2] = true;
      }
    }

    /** Gets the value of the 'address' field */
    public java.util.List<org.apache.hadoop.hive.hbase.avro.Address> getAddress() {
      return address;
    }
    
    /** Sets the value of the 'address' field */
    public org.apache.hadoop.hive.hbase.avro.ContactInfo.Builder setAddress(java.util.List<org.apache.hadoop.hive.hbase.avro.Address> value) {
      validate(fields()[0], value);
      this.address = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'address' field has been set */
    public boolean hasAddress() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'address' field */
    public org.apache.hadoop.hive.hbase.avro.ContactInfo.Builder clearAddress() {
      address = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'homePhone' field */
    public org.apache.hadoop.hive.hbase.avro.HomePhone getHomePhone() {
      return homePhone;
    }
    
    /** Sets the value of the 'homePhone' field */
    public org.apache.hadoop.hive.hbase.avro.ContactInfo.Builder setHomePhone(org.apache.hadoop.hive.hbase.avro.HomePhone value) {
      validate(fields()[1], value);
      this.homePhone = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'homePhone' field has been set */
    public boolean hasHomePhone() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'homePhone' field */
    public org.apache.hadoop.hive.hbase.avro.ContactInfo.Builder clearHomePhone() {
      homePhone = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'officePhone' field */
    public org.apache.hadoop.hive.hbase.avro.OfficePhone getOfficePhone() {
      return officePhone;
    }
    
    /** Sets the value of the 'officePhone' field */
    public org.apache.hadoop.hive.hbase.avro.ContactInfo.Builder setOfficePhone(org.apache.hadoop.hive.hbase.avro.OfficePhone value) {
      validate(fields()[2], value);
      this.officePhone = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'officePhone' field has been set */
    public boolean hasOfficePhone() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'officePhone' field */
    public org.apache.hadoop.hive.hbase.avro.ContactInfo.Builder clearOfficePhone() {
      officePhone = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public ContactInfo build() {
      try {
        ContactInfo record = new ContactInfo();
        record.address = fieldSetFlags()[0] ? this.address : (java.util.List<org.apache.hadoop.hive.hbase.avro.Address>) defaultValue(fields()[0]);
        record.homePhone = fieldSetFlags()[1] ? this.homePhone : (org.apache.hadoop.hive.hbase.avro.HomePhone) defaultValue(fields()[1]);
        record.officePhone = fieldSetFlags()[2] ? this.officePhone : (org.apache.hadoop.hive.hbase.avro.OfficePhone) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}
