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

org.opencb.biodata.models.variant.metadata.VariantFileHeader Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.opencb.biodata.models.variant.metadata;  
@SuppressWarnings("all")
/** Variant File Header. Contains simple and complex metadata lines describing the content of the file.
    This header matches with the VCF header.
    A header may have multiple Simple or Complex lines with the same key */
@org.apache.avro.specific.AvroGenerated
public class VariantFileHeader 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\":\"VariantFileHeader\",\"namespace\":\"org.opencb.biodata.models.variant.metadata\",\"doc\":\"Variant File Header. Contains simple and complex metadata lines describing the content of the file.\\n    This header matches with the VCF header.\\n    A header may have multiple Simple or Complex lines with the same key\",\"fields\":[{\"name\":\"version\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"complexLines\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"VariantFileHeaderComplexLine\",\"fields\":[{\"name\":\"key\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Key of group of the Complex Header Line, e.g. INFO, FORMAT, FILTER, ALT, ...\"},{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"ID or Name of the line\"},{\"name\":\"description\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The description\",\"default\":null},{\"name\":\"number\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Arity of the values associated with this metadata line.\\n        Only present if the metadata line describes data fields, i.e. key == INFO or FORMAT\\n        Accepted values:\\n          - : The field has always this number of values.\\n          - A: The field has one value per alternate allele.\\n          - R: The field has one value for each possible allele, including the reference.\\n          - G: The field has one value for each possible genotype\\n          - .: The number of possible values varies, is unknown or unbounded.\",\"default\":null},{\"name\":\"type\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Type of the values associated with this metadata line.\\n        Only present if the metadata line describes data fields, i.e. key == INFO or FORMAT\\n        Accepted values:\\n          - Integer\\n          - Float\\n          - String\\n          - Character\\n          - Flag\",\"default\":null},{\"name\":\"genericFields\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"Other optional fields\",\"default\":{}}]}},\"doc\":\"complex lines, e.g. INFO=\",\"default\":[]},{\"name\":\"simpleLines\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"VariantFileHeaderSimpleLine\",\"fields\":[{\"name\":\"key\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Key of group of the Simple Header Line, e.g. source, assembly, pedigreeDB, ...\"},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Value\"}]}},\"doc\":\"simple lines, e.g. fileDate=20090805\",\"default\":[]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private java.lang.String version;
  /** complex lines, e.g. INFO= */
   private java.util.List complexLines;
  /** simple lines, e.g. fileDate=20090805 */
   private java.util.List simpleLines;

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

  /**
   * All-args constructor.
   */
  public VariantFileHeader(java.lang.String version, java.util.List complexLines, java.util.List simpleLines) {
    this.version = version;
    this.complexLines = complexLines;
    this.simpleLines = simpleLines;
  }

  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 version;
    case 1: return complexLines;
    case 2: return simpleLines;
    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: version = (java.lang.String)value$; break;
    case 1: complexLines = (java.util.List)value$; break;
    case 2: simpleLines = (java.util.List)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

  /**
   * Gets the value of the 'complexLines' field.
   * complex lines, e.g. INFO=   */
  public java.util.List getComplexLines() {
    return complexLines;
  }

  /**
   * Sets the value of the 'complexLines' field.
   * complex lines, e.g. INFO=   * @param value the value to set.
   */
  public void setComplexLines(java.util.List value) {
    this.complexLines = value;
  }

  /**
   * Gets the value of the 'simpleLines' field.
   * simple lines, e.g. fileDate=20090805   */
  public java.util.List getSimpleLines() {
    return simpleLines;
  }

  /**
   * Sets the value of the 'simpleLines' field.
   * simple lines, e.g. fileDate=20090805   * @param value the value to set.
   */
  public void setSimpleLines(java.util.List value) {
    this.simpleLines = value;
  }

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

    private java.lang.String version;
    private java.util.List complexLines;
    private java.util.List simpleLines;

    /** Creates a new Builder */
    private Builder() {
      super(org.opencb.biodata.models.variant.metadata.VariantFileHeader.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.opencb.biodata.models.variant.metadata.VariantFileHeader.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.version)) {
        this.version = data().deepCopy(fields()[0].schema(), other.version);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.complexLines)) {
        this.complexLines = data().deepCopy(fields()[1].schema(), other.complexLines);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.simpleLines)) {
        this.simpleLines = data().deepCopy(fields()[2].schema(), other.simpleLines);
        fieldSetFlags()[2] = true;
      }
    }
    
    /** Creates a Builder by copying an existing VariantFileHeader instance */
    private Builder(org.opencb.biodata.models.variant.metadata.VariantFileHeader other) {
            super(org.opencb.biodata.models.variant.metadata.VariantFileHeader.SCHEMA$);
      if (isValidValue(fields()[0], other.version)) {
        this.version = data().deepCopy(fields()[0].schema(), other.version);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.complexLines)) {
        this.complexLines = data().deepCopy(fields()[1].schema(), other.complexLines);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.simpleLines)) {
        this.simpleLines = data().deepCopy(fields()[2].schema(), other.simpleLines);
        fieldSetFlags()[2] = true;
      }
    }

    /** Gets the value of the 'version' field */
    public java.lang.String getVersion() {
      return version;
    }
    
    /** Sets the value of the 'version' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileHeader.Builder setVersion(java.lang.String value) {
      validate(fields()[0], value);
      this.version = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'version' field has been set */
    public boolean hasVersion() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'version' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileHeader.Builder clearVersion() {
      version = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'complexLines' field */
    public java.util.List getComplexLines() {
      return complexLines;
    }
    
    /** Sets the value of the 'complexLines' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileHeader.Builder setComplexLines(java.util.List value) {
      validate(fields()[1], value);
      this.complexLines = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'complexLines' field has been set */
    public boolean hasComplexLines() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'complexLines' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileHeader.Builder clearComplexLines() {
      complexLines = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'simpleLines' field */
    public java.util.List getSimpleLines() {
      return simpleLines;
    }
    
    /** Sets the value of the 'simpleLines' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileHeader.Builder setSimpleLines(java.util.List value) {
      validate(fields()[2], value);
      this.simpleLines = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'simpleLines' field has been set */
    public boolean hasSimpleLines() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'simpleLines' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileHeader.Builder clearSimpleLines() {
      simpleLines = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public VariantFileHeader build() {
      try {
        VariantFileHeader record = new VariantFileHeader();
        record.version = fieldSetFlags()[0] ? this.version : (java.lang.String) defaultValue(fields()[0]);
        record.complexLines = fieldSetFlags()[1] ? this.complexLines : (java.util.List) defaultValue(fields()[1]);
        record.simpleLines = fieldSetFlags()[2] ? this.simpleLines : (java.util.List) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy