All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opencb.biodata.models.metadata.Individual Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.opencb.biodata.models.metadata;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Individual 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\":\"Individual\",\"namespace\":\"org.opencb.biodata.models.metadata\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Individual identifier\"},{\"name\":\"family\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"father\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"mother\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"sex\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"phenotype\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"samples\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"Sample\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Sample identifier\"},{\"name\":\"annotations\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"Sample annotations stored in a map of attributes according to the format:\\n         attribute_name[:x] where x defines the attribute type, its valid values are:\\n             n for numeric (i = integer, f = float)\\n             s for string\\n             b for boolean\\n\\n         e.g. age:n, population:s, height:n, weight, risk factors, secondary conditions,...\",\"default\":{}}]}},\"default\":[]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** Individual identifier */
   private java.lang.String id;
   private java.lang.String family;
   private java.lang.String father;
   private java.lang.String mother;
   private java.lang.String sex;
   private java.lang.String phenotype;
   private java.util.List samples;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder(). 
   */
  public Individual() {}

  /**
   * All-args constructor.
   */
  public Individual(java.lang.String id, java.lang.String family, java.lang.String father, java.lang.String mother, java.lang.String sex, java.lang.String phenotype, java.util.List samples) {
    this.id = id;
    this.family = family;
    this.father = father;
    this.mother = mother;
    this.sex = sex;
    this.phenotype = phenotype;
    this.samples = samples;
  }

  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 family;
    case 2: return father;
    case 3: return mother;
    case 4: return sex;
    case 5: return phenotype;
    case 6: return samples;
    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: family = (java.lang.String)value$; break;
    case 2: father = (java.lang.String)value$; break;
    case 3: mother = (java.lang.String)value$; break;
    case 4: sex = (java.lang.String)value$; break;
    case 5: phenotype = (java.lang.String)value$; break;
    case 6: samples = (java.util.List)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

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

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

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

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

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

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

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

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

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

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

  /**
   * Gets the value of the 'samples' field.
   */
  public java.util.List getSamples() {
    return samples;
  }

  /**
   * Sets the value of the 'samples' field.
   * @param value the value to set.
   */
  public void setSamples(java.util.List value) {
    this.samples = value;
  }

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

    private java.lang.String id;
    private java.lang.String family;
    private java.lang.String father;
    private java.lang.String mother;
    private java.lang.String sex;
    private java.lang.String phenotype;
    private java.util.List samples;

    /** Creates a new Builder */
    private Builder() {
      super(org.opencb.biodata.models.metadata.Individual.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.opencb.biodata.models.metadata.Individual.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.family)) {
        this.family = data().deepCopy(fields()[1].schema(), other.family);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.father)) {
        this.father = data().deepCopy(fields()[2].schema(), other.father);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.mother)) {
        this.mother = data().deepCopy(fields()[3].schema(), other.mother);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.sex)) {
        this.sex = data().deepCopy(fields()[4].schema(), other.sex);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.phenotype)) {
        this.phenotype = data().deepCopy(fields()[5].schema(), other.phenotype);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.samples)) {
        this.samples = data().deepCopy(fields()[6].schema(), other.samples);
        fieldSetFlags()[6] = true;
      }
    }
    
    /** Creates a Builder by copying an existing Individual instance */
    private Builder(org.opencb.biodata.models.metadata.Individual other) {
            super(org.opencb.biodata.models.metadata.Individual.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.family)) {
        this.family = data().deepCopy(fields()[1].schema(), other.family);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.father)) {
        this.father = data().deepCopy(fields()[2].schema(), other.father);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.mother)) {
        this.mother = data().deepCopy(fields()[3].schema(), other.mother);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.sex)) {
        this.sex = data().deepCopy(fields()[4].schema(), other.sex);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.phenotype)) {
        this.phenotype = data().deepCopy(fields()[5].schema(), other.phenotype);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.samples)) {
        this.samples = data().deepCopy(fields()[6].schema(), other.samples);
        fieldSetFlags()[6] = 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.metadata.Individual.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.metadata.Individual.Builder clearId() {
      id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'family' field */
    public java.lang.String getFamily() {
      return family;
    }
    
    /** Sets the value of the 'family' field */
    public org.opencb.biodata.models.metadata.Individual.Builder setFamily(java.lang.String value) {
      validate(fields()[1], value);
      this.family = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'family' field has been set */
    public boolean hasFamily() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'family' field */
    public org.opencb.biodata.models.metadata.Individual.Builder clearFamily() {
      family = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'father' field */
    public java.lang.String getFather() {
      return father;
    }
    
    /** Sets the value of the 'father' field */
    public org.opencb.biodata.models.metadata.Individual.Builder setFather(java.lang.String value) {
      validate(fields()[2], value);
      this.father = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'father' field has been set */
    public boolean hasFather() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'father' field */
    public org.opencb.biodata.models.metadata.Individual.Builder clearFather() {
      father = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /** Gets the value of the 'mother' field */
    public java.lang.String getMother() {
      return mother;
    }
    
    /** Sets the value of the 'mother' field */
    public org.opencb.biodata.models.metadata.Individual.Builder setMother(java.lang.String value) {
      validate(fields()[3], value);
      this.mother = value;
      fieldSetFlags()[3] = true;
      return this; 
    }
    
    /** Checks whether the 'mother' field has been set */
    public boolean hasMother() {
      return fieldSetFlags()[3];
    }
    
    /** Clears the value of the 'mother' field */
    public org.opencb.biodata.models.metadata.Individual.Builder clearMother() {
      mother = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /** Gets the value of the 'sex' field */
    public java.lang.String getSex() {
      return sex;
    }
    
    /** Sets the value of the 'sex' field */
    public org.opencb.biodata.models.metadata.Individual.Builder setSex(java.lang.String value) {
      validate(fields()[4], value);
      this.sex = value;
      fieldSetFlags()[4] = true;
      return this; 
    }
    
    /** Checks whether the 'sex' field has been set */
    public boolean hasSex() {
      return fieldSetFlags()[4];
    }
    
    /** Clears the value of the 'sex' field */
    public org.opencb.biodata.models.metadata.Individual.Builder clearSex() {
      sex = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /** Gets the value of the 'phenotype' field */
    public java.lang.String getPhenotype() {
      return phenotype;
    }
    
    /** Sets the value of the 'phenotype' field */
    public org.opencb.biodata.models.metadata.Individual.Builder setPhenotype(java.lang.String value) {
      validate(fields()[5], value);
      this.phenotype = value;
      fieldSetFlags()[5] = true;
      return this; 
    }
    
    /** Checks whether the 'phenotype' field has been set */
    public boolean hasPhenotype() {
      return fieldSetFlags()[5];
    }
    
    /** Clears the value of the 'phenotype' field */
    public org.opencb.biodata.models.metadata.Individual.Builder clearPhenotype() {
      phenotype = null;
      fieldSetFlags()[5] = false;
      return this;
    }

    /** Gets the value of the 'samples' field */
    public java.util.List getSamples() {
      return samples;
    }
    
    /** Sets the value of the 'samples' field */
    public org.opencb.biodata.models.metadata.Individual.Builder setSamples(java.util.List value) {
      validate(fields()[6], value);
      this.samples = value;
      fieldSetFlags()[6] = true;
      return this; 
    }
    
    /** Checks whether the 'samples' field has been set */
    public boolean hasSamples() {
      return fieldSetFlags()[6];
    }
    
    /** Clears the value of the 'samples' field */
    public org.opencb.biodata.models.metadata.Individual.Builder clearSamples() {
      samples = null;
      fieldSetFlags()[6] = false;
      return this;
    }

    @Override
    public Individual build() {
      try {
        Individual record = new Individual();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
        record.family = fieldSetFlags()[1] ? this.family : (java.lang.String) defaultValue(fields()[1]);
        record.father = fieldSetFlags()[2] ? this.father : (java.lang.String) defaultValue(fields()[2]);
        record.mother = fieldSetFlags()[3] ? this.mother : (java.lang.String) defaultValue(fields()[3]);
        record.sex = fieldSetFlags()[4] ? this.sex : (java.lang.String) defaultValue(fields()[4]);
        record.phenotype = fieldSetFlags()[5] ? this.phenotype : (java.lang.String) defaultValue(fields()[5]);
        record.samples = fieldSetFlags()[6] ? this.samples : (java.util.List) defaultValue(fields()[6]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy