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

org.gel.models.report.avro.DemographicElegibilityCriteria Maven / Gradle / Ivy

/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.gel.models.report.avro;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class DemographicElegibilityCriteria 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\":\"DemographicElegibilityCriteria\",\"namespace\":\"org.gel.models.report.avro\",\"fields\":[{\"name\":\"sex\",\"type\":{\"type\":\"enum\",\"name\":\"Sex\",\"namespace\":\"org.gel.models.participant.avro\",\"doc\":\"Sex\",\"symbols\":[\"MALE\",\"FEMALE\",\"UNKNOWN\"]}},{\"name\":\"ageRange\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"AgeRange\",\"fields\":[{\"name\":\"minimumAge\",\"type\":\"int\"},{\"name\":\"maximumAge\",\"type\":\"int\"},{\"name\":\"timeunit\",\"type\":{\"type\":\"enum\",\"name\":\"TimeUnit\",\"symbols\":[\"years\",\"months\",\"weeks\",\"days\",\"hours\",\"minutes\",\"na\"]}}]}]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private org.gel.models.participant.avro.Sex sex;
   private org.gel.models.report.avro.AgeRange ageRange;

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

  /**
   * All-args constructor.
   */
  public DemographicElegibilityCriteria(org.gel.models.participant.avro.Sex sex, org.gel.models.report.avro.AgeRange ageRange) {
    this.sex = sex;
    this.ageRange = ageRange;
  }

  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 sex;
    case 1: return ageRange;
    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: sex = (org.gel.models.participant.avro.Sex)value$; break;
    case 1: ageRange = (org.gel.models.report.avro.AgeRange)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'sex' field.
   */
  public org.gel.models.participant.avro.Sex getSex() {
    return sex;
  }

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

  /**
   * Gets the value of the 'ageRange' field.
   */
  public org.gel.models.report.avro.AgeRange getAgeRange() {
    return ageRange;
  }

  /**
   * Sets the value of the 'ageRange' field.
   * @param value the value to set.
   */
  public void setAgeRange(org.gel.models.report.avro.AgeRange value) {
    this.ageRange = value;
  }

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

    private org.gel.models.participant.avro.Sex sex;
    private org.gel.models.report.avro.AgeRange ageRange;

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

    /** Gets the value of the 'sex' field */
    public org.gel.models.participant.avro.Sex getSex() {
      return sex;
    }
    
    /** Sets the value of the 'sex' field */
    public org.gel.models.report.avro.DemographicElegibilityCriteria.Builder setSex(org.gel.models.participant.avro.Sex value) {
      validate(fields()[0], value);
      this.sex = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'sex' field has been set */
    public boolean hasSex() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'sex' field */
    public org.gel.models.report.avro.DemographicElegibilityCriteria.Builder clearSex() {
      sex = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'ageRange' field */
    public org.gel.models.report.avro.AgeRange getAgeRange() {
      return ageRange;
    }
    
    /** Sets the value of the 'ageRange' field */
    public org.gel.models.report.avro.DemographicElegibilityCriteria.Builder setAgeRange(org.gel.models.report.avro.AgeRange value) {
      validate(fields()[1], value);
      this.ageRange = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'ageRange' field has been set */
    public boolean hasAgeRange() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'ageRange' field */
    public org.gel.models.report.avro.DemographicElegibilityCriteria.Builder clearAgeRange() {
      ageRange = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    @Override
    public DemographicElegibilityCriteria build() {
      try {
        DemographicElegibilityCriteria record = new DemographicElegibilityCriteria();
        record.sex = fieldSetFlags()[0] ? this.sex : (org.gel.models.participant.avro.Sex) defaultValue(fields()[0]);
        record.ageRange = fieldSetFlags()[1] ? this.ageRange : (org.gel.models.report.avro.AgeRange) defaultValue(fields()[1]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy