/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.opencb.biodata.models.variant.avro;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class ProteinFeature 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\":\"ProteinFeature\",\"namespace\":\"org.opencb.biodata.models.variant.avro\",\"fields\":[{\"name\":\"id\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]},{\"name\":\"start\",\"type\":\"int\"},{\"name\":\"end\",\"type\":\"int\"},{\"name\":\"type\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"description\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private java.lang.String id;
   private int start;
   private int end;
   private java.lang.String type;
   private java.lang.String description;

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

  /**
   * All-args constructor.
   */
  public ProteinFeature(java.lang.String id, java.lang.Integer start, java.lang.Integer end, java.lang.String type, java.lang.String description) {
    this.id = id;
    this.start = start;
    this.end = end;
    this.type = type;
    this.description = description;
  }

  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 start;
    case 2: return end;
    case 3: return type;
    case 4: return description;
    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.String)value$; break;
    case 1: start = (java.lang.Integer)value$; break;
    case 2: end = (java.lang.Integer)value$; break;
    case 3: type = (java.lang.String)value$; break;
    case 4: description = (java.lang.String)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

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

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

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

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

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

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

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

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

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

    private java.lang.String id;
    private int start;
    private int end;
    private java.lang.String type;
    private java.lang.String description;

    /** Creates a new Builder */
    private Builder() {
      super(org.opencb.biodata.models.variant.avro.ProteinFeature.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.opencb.biodata.models.variant.avro.ProteinFeature.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.start)) {
        this.start = data().deepCopy(fields()[1].schema(), other.start);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.end)) {
        this.end = data().deepCopy(fields()[2].schema(), other.end);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.type)) {
        this.type = data().deepCopy(fields()[3].schema(), other.type);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.description)) {
        this.description = data().deepCopy(fields()[4].schema(), other.description);
        fieldSetFlags()[4] = true;
      }
    }
    
    /** Creates a Builder by copying an existing ProteinFeature instance */
    private Builder(org.opencb.biodata.models.variant.avro.ProteinFeature other) {
            super(org.opencb.biodata.models.variant.avro.ProteinFeature.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.start)) {
        this.start = data().deepCopy(fields()[1].schema(), other.start);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.end)) {
        this.end = data().deepCopy(fields()[2].schema(), other.end);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.type)) {
        this.type = data().deepCopy(fields()[3].schema(), other.type);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.description)) {
        this.description = data().deepCopy(fields()[4].schema(), other.description);
        fieldSetFlags()[4] = true;
      }
    }

    /** Gets the value of the 'id' field */
    public java.lang.String getId() {
      return id;
    }
    
    /** Sets the value of the 'id' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder setId(java.lang.String 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.opencb.biodata.models.variant.avro.ProteinFeature.Builder clearId() {
      id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'start' field */
    public java.lang.Integer getStart() {
      return start;
    }
    
    /** Sets the value of the 'start' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder setStart(int value) {
      validate(fields()[1], value);
      this.start = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'start' field has been set */
    public boolean hasStart() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'start' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder clearStart() {
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'end' field */
    public java.lang.Integer getEnd() {
      return end;
    }
    
    /** Sets the value of the 'end' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder setEnd(int value) {
      validate(fields()[2], value);
      this.end = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'end' field has been set */
    public boolean hasEnd() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'end' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder clearEnd() {
      fieldSetFlags()[2] = false;
      return this;
    }

    /** Gets the value of the 'type' field */
    public java.lang.String getType() {
      return type;
    }
    
    /** Sets the value of the 'type' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder setType(java.lang.String value) {
      validate(fields()[3], value);
      this.type = value;
      fieldSetFlags()[3] = true;
      return this; 
    }
    
    /** Checks whether the 'type' field has been set */
    public boolean hasType() {
      return fieldSetFlags()[3];
    }
    
    /** Clears the value of the 'type' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder clearType() {
      type = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /** Gets the value of the 'description' field */
    public java.lang.String getDescription() {
      return description;
    }
    
    /** Sets the value of the 'description' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder setDescription(java.lang.String value) {
      validate(fields()[4], value);
      this.description = value;
      fieldSetFlags()[4] = true;
      return this; 
    }
    
    /** Checks whether the 'description' field has been set */
    public boolean hasDescription() {
      return fieldSetFlags()[4];
    }
    
    /** Clears the value of the 'description' field */
    public org.opencb.biodata.models.variant.avro.ProteinFeature.Builder clearDescription() {
      description = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    @Override
    public ProteinFeature build() {
      try {
        ProteinFeature record = new ProteinFeature();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
        record.start = fieldSetFlags()[1] ? this.start : (java.lang.Integer) defaultValue(fields()[1]);
        record.end = fieldSetFlags()[2] ? this.end : (java.lang.Integer) defaultValue(fields()[2]);
        record.type = fieldSetFlags()[3] ? this.type : (java.lang.String) defaultValue(fields()[3]);
        record.description = fieldSetFlags()[4] ? this.description : (java.lang.String) defaultValue(fields()[4]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}
