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

org.opencb.biodata.models.metadata.Sample 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 Sample 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\":\"Sample\",\"namespace\":\"org.opencb.biodata.models.metadata\",\"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\":{}}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** Sample identifier */
   private java.lang.String id;
  /** Sample annotations stored in a map of attributes according to the format:
         attribute_name[:x] where x defines the attribute type, its valid values are:
             n for numeric (i = integer, f = float)
             s for string
             b for boolean

         e.g. age:n, population:s, height:n, weight, risk factors, secondary conditions,... */
   private java.util.Map annotations;

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

  /**
   * All-args constructor.
   */
  public Sample(java.lang.String id, java.util.Map annotations) {
    this.id = id;
    this.annotations = annotations;
  }

  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 annotations;
    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: annotations = (java.util.Map)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

  /**
   * Gets the value of the 'annotations' field.
   * Sample annotations stored in a map of attributes according to the format:
         attribute_name[:x] where x defines the attribute type, its valid values are:
             n for numeric (i = integer, f = float)
             s for string
             b for boolean

         e.g. age:n, population:s, height:n, weight, risk factors, secondary conditions,...   */
  public java.util.Map getAnnotations() {
    return annotations;
  }

  /**
   * Sets the value of the 'annotations' field.
   * Sample annotations stored in a map of attributes according to the format:
         attribute_name[:x] where x defines the attribute type, its valid values are:
             n for numeric (i = integer, f = float)
             s for string
             b for boolean

         e.g. age:n, population:s, height:n, weight, risk factors, secondary conditions,...   * @param value the value to set.
   */
  public void setAnnotations(java.util.Map value) {
    this.annotations = value;
  }

  /** Creates a new Sample RecordBuilder */
  public static org.opencb.biodata.models.metadata.Sample.Builder newBuilder() {
    return new org.opencb.biodata.models.metadata.Sample.Builder();
  }
  
  /** Creates a new Sample RecordBuilder by copying an existing Builder */
  public static org.opencb.biodata.models.metadata.Sample.Builder newBuilder(org.opencb.biodata.models.metadata.Sample.Builder other) {
    return new org.opencb.biodata.models.metadata.Sample.Builder(other);
  }
  
  /** Creates a new Sample RecordBuilder by copying an existing Sample instance */
  public static org.opencb.biodata.models.metadata.Sample.Builder newBuilder(org.opencb.biodata.models.metadata.Sample other) {
    return new org.opencb.biodata.models.metadata.Sample.Builder(other);
  }
  
  /**
   * RecordBuilder for Sample 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.Map annotations;

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

    /** Gets the value of the 'annotations' field */
    public java.util.Map getAnnotations() {
      return annotations;
    }
    
    /** Sets the value of the 'annotations' field */
    public org.opencb.biodata.models.metadata.Sample.Builder setAnnotations(java.util.Map value) {
      validate(fields()[1], value);
      this.annotations = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'annotations' field has been set */
    public boolean hasAnnotations() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'annotations' field */
    public org.opencb.biodata.models.metadata.Sample.Builder clearAnnotations() {
      annotations = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    @Override
    public Sample build() {
      try {
        Sample record = new Sample();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
        record.annotations = fieldSetFlags()[1] ? this.annotations : (java.util.Map) defaultValue(fields()[1]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy