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

org.gel.models.participant.avro.PreviousTreatment Maven / Gradle / Ivy

/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.gel.models.participant.avro;  
@SuppressWarnings("all")
/** In GMS, Previous Treatment of Patient */
@org.apache.avro.specific.AvroGenerated
public class PreviousTreatment 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\":\"PreviousTreatment\",\"namespace\":\"org.gel.models.participant.avro\",\"doc\":\"In GMS, Previous Treatment of Patient\",\"fields\":[{\"name\":\"previousTreatmentType\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]},{\"name\":\"previousTreatmentName\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]},{\"name\":\"previousTreatmentDate\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"Date\",\"doc\":\"This defines a date record\",\"fields\":[{\"name\":\"year\",\"type\":\"int\",\"doc\":\"Format YYYY\"},{\"name\":\"month\",\"type\":[\"null\",\"int\"],\"doc\":\"Format MM. e.g June is 06\"},{\"name\":\"day\",\"type\":[\"null\",\"int\"],\"doc\":\"Format DD e.g. 12th of October is 12\"}]}]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private java.lang.String previousTreatmentType;
   private java.lang.String previousTreatmentName;
   private org.gel.models.participant.avro.Date previousTreatmentDate;

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

  /**
   * All-args constructor.
   */
  public PreviousTreatment(java.lang.String previousTreatmentType, java.lang.String previousTreatmentName, org.gel.models.participant.avro.Date previousTreatmentDate) {
    this.previousTreatmentType = previousTreatmentType;
    this.previousTreatmentName = previousTreatmentName;
    this.previousTreatmentDate = previousTreatmentDate;
  }

  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 previousTreatmentType;
    case 1: return previousTreatmentName;
    case 2: return previousTreatmentDate;
    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: previousTreatmentType = (java.lang.String)value$; break;
    case 1: previousTreatmentName = (java.lang.String)value$; break;
    case 2: previousTreatmentDate = (org.gel.models.participant.avro.Date)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

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

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

  /**
   * Gets the value of the 'previousTreatmentDate' field.
   */
  public org.gel.models.participant.avro.Date getPreviousTreatmentDate() {
    return previousTreatmentDate;
  }

  /**
   * Sets the value of the 'previousTreatmentDate' field.
   * @param value the value to set.
   */
  public void setPreviousTreatmentDate(org.gel.models.participant.avro.Date value) {
    this.previousTreatmentDate = value;
  }

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

    private java.lang.String previousTreatmentType;
    private java.lang.String previousTreatmentName;
    private org.gel.models.participant.avro.Date previousTreatmentDate;

    /** Creates a new Builder */
    private Builder() {
      super(org.gel.models.participant.avro.PreviousTreatment.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.gel.models.participant.avro.PreviousTreatment.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.previousTreatmentType)) {
        this.previousTreatmentType = data().deepCopy(fields()[0].schema(), other.previousTreatmentType);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.previousTreatmentName)) {
        this.previousTreatmentName = data().deepCopy(fields()[1].schema(), other.previousTreatmentName);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.previousTreatmentDate)) {
        this.previousTreatmentDate = data().deepCopy(fields()[2].schema(), other.previousTreatmentDate);
        fieldSetFlags()[2] = true;
      }
    }
    
    /** Creates a Builder by copying an existing PreviousTreatment instance */
    private Builder(org.gel.models.participant.avro.PreviousTreatment other) {
            super(org.gel.models.participant.avro.PreviousTreatment.SCHEMA$);
      if (isValidValue(fields()[0], other.previousTreatmentType)) {
        this.previousTreatmentType = data().deepCopy(fields()[0].schema(), other.previousTreatmentType);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.previousTreatmentName)) {
        this.previousTreatmentName = data().deepCopy(fields()[1].schema(), other.previousTreatmentName);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.previousTreatmentDate)) {
        this.previousTreatmentDate = data().deepCopy(fields()[2].schema(), other.previousTreatmentDate);
        fieldSetFlags()[2] = true;
      }
    }

    /** Gets the value of the 'previousTreatmentType' field */
    public java.lang.String getPreviousTreatmentType() {
      return previousTreatmentType;
    }
    
    /** Sets the value of the 'previousTreatmentType' field */
    public org.gel.models.participant.avro.PreviousTreatment.Builder setPreviousTreatmentType(java.lang.String value) {
      validate(fields()[0], value);
      this.previousTreatmentType = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'previousTreatmentType' field has been set */
    public boolean hasPreviousTreatmentType() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'previousTreatmentType' field */
    public org.gel.models.participant.avro.PreviousTreatment.Builder clearPreviousTreatmentType() {
      previousTreatmentType = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'previousTreatmentName' field */
    public java.lang.String getPreviousTreatmentName() {
      return previousTreatmentName;
    }
    
    /** Sets the value of the 'previousTreatmentName' field */
    public org.gel.models.participant.avro.PreviousTreatment.Builder setPreviousTreatmentName(java.lang.String value) {
      validate(fields()[1], value);
      this.previousTreatmentName = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'previousTreatmentName' field has been set */
    public boolean hasPreviousTreatmentName() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'previousTreatmentName' field */
    public org.gel.models.participant.avro.PreviousTreatment.Builder clearPreviousTreatmentName() {
      previousTreatmentName = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'previousTreatmentDate' field */
    public org.gel.models.participant.avro.Date getPreviousTreatmentDate() {
      return previousTreatmentDate;
    }
    
    /** Sets the value of the 'previousTreatmentDate' field */
    public org.gel.models.participant.avro.PreviousTreatment.Builder setPreviousTreatmentDate(org.gel.models.participant.avro.Date value) {
      validate(fields()[2], value);
      this.previousTreatmentDate = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'previousTreatmentDate' field has been set */
    public boolean hasPreviousTreatmentDate() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'previousTreatmentDate' field */
    public org.gel.models.participant.avro.PreviousTreatment.Builder clearPreviousTreatmentDate() {
      previousTreatmentDate = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public PreviousTreatment build() {
      try {
        PreviousTreatment record = new PreviousTreatment();
        record.previousTreatmentType = fieldSetFlags()[0] ? this.previousTreatmentType : (java.lang.String) defaultValue(fields()[0]);
        record.previousTreatmentName = fieldSetFlags()[1] ? this.previousTreatmentName : (java.lang.String) defaultValue(fields()[1]);
        record.previousTreatmentDate = fieldSetFlags()[2] ? this.previousTreatmentDate : (org.gel.models.participant.avro.Date) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy