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

org.opencb.biodata.models.metadata.Cohort 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 Cohort 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\":\"Cohort\",\"namespace\":\"org.opencb.biodata.models.metadata\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"sampleIds\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},\"default\":[]},{\"name\":\"sampleSetType\",\"type\":{\"type\":\"enum\",\"name\":\"SampleSetType\",\"symbols\":[\"CASE_CONTROL\",\"CASE_SET\",\"CONTROL_SET\",\"PAIRED\",\"TIME_SERIES\",\"FAMILY\",\"TRIO\",\"MISCELLANEOUS\",\"UNKNOWN\"]}}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private java.lang.String id;
   private java.util.List sampleIds;
   private org.opencb.biodata.models.metadata.SampleSetType sampleSetType;

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

  /**
   * All-args constructor.
   */
  public Cohort(java.lang.String id, java.util.List sampleIds, org.opencb.biodata.models.metadata.SampleSetType sampleSetType) {
    this.id = id;
    this.sampleIds = sampleIds;
    this.sampleSetType = sampleSetType;
  }

  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 sampleIds;
    case 2: return sampleSetType;
    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: sampleIds = (java.util.List)value$; break;
    case 2: sampleSetType = (org.opencb.biodata.models.metadata.SampleSetType)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 'sampleIds' field.
   */
  public java.util.List getSampleIds() {
    return sampleIds;
  }

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

  /**
   * Gets the value of the 'sampleSetType' field.
   */
  public org.opencb.biodata.models.metadata.SampleSetType getSampleSetType() {
    return sampleSetType;
  }

  /**
   * Sets the value of the 'sampleSetType' field.
   * @param value the value to set.
   */
  public void setSampleSetType(org.opencb.biodata.models.metadata.SampleSetType value) {
    this.sampleSetType = value;
  }

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

    private java.lang.String id;
    private java.util.List sampleIds;
    private org.opencb.biodata.models.metadata.SampleSetType sampleSetType;

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

    /** Gets the value of the 'sampleIds' field */
    public java.util.List getSampleIds() {
      return sampleIds;
    }
    
    /** Sets the value of the 'sampleIds' field */
    public org.opencb.biodata.models.metadata.Cohort.Builder setSampleIds(java.util.List value) {
      validate(fields()[1], value);
      this.sampleIds = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'sampleIds' field has been set */
    public boolean hasSampleIds() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'sampleIds' field */
    public org.opencb.biodata.models.metadata.Cohort.Builder clearSampleIds() {
      sampleIds = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'sampleSetType' field */
    public org.opencb.biodata.models.metadata.SampleSetType getSampleSetType() {
      return sampleSetType;
    }
    
    /** Sets the value of the 'sampleSetType' field */
    public org.opencb.biodata.models.metadata.Cohort.Builder setSampleSetType(org.opencb.biodata.models.metadata.SampleSetType value) {
      validate(fields()[2], value);
      this.sampleSetType = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'sampleSetType' field has been set */
    public boolean hasSampleSetType() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'sampleSetType' field */
    public org.opencb.biodata.models.metadata.Cohort.Builder clearSampleSetType() {
      sampleSetType = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public Cohort build() {
      try {
        Cohort record = new Cohort();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
        record.sampleIds = fieldSetFlags()[1] ? this.sampleIds : (java.util.List) defaultValue(fields()[1]);
        record.sampleSetType = fieldSetFlags()[2] ? this.sampleSetType : (org.opencb.biodata.models.metadata.SampleSetType) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy