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

org.gel.models.report.avro.AgeRange 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 AgeRange 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\":\"AgeRange\",\"namespace\":\"org.gel.models.report.avro\",\"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 int minimumAge;
   private int maximumAge;
   private org.gel.models.report.avro.TimeUnit timeunit;

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

  /**
   * All-args constructor.
   */
  public AgeRange(java.lang.Integer minimumAge, java.lang.Integer maximumAge, org.gel.models.report.avro.TimeUnit timeunit) {
    this.minimumAge = minimumAge;
    this.maximumAge = maximumAge;
    this.timeunit = timeunit;
  }

  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 minimumAge;
    case 1: return maximumAge;
    case 2: return timeunit;
    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: minimumAge = (java.lang.Integer)value$; break;
    case 1: maximumAge = (java.lang.Integer)value$; break;
    case 2: timeunit = (org.gel.models.report.avro.TimeUnit)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'minimumAge' field.
   */
  public java.lang.Integer getMinimumAge() {
    return minimumAge;
  }

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

  /**
   * Gets the value of the 'maximumAge' field.
   */
  public java.lang.Integer getMaximumAge() {
    return maximumAge;
  }

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

  /**
   * Gets the value of the 'timeunit' field.
   */
  public org.gel.models.report.avro.TimeUnit getTimeunit() {
    return timeunit;
  }

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

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

    private int minimumAge;
    private int maximumAge;
    private org.gel.models.report.avro.TimeUnit timeunit;

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

    /** Gets the value of the 'minimumAge' field */
    public java.lang.Integer getMinimumAge() {
      return minimumAge;
    }
    
    /** Sets the value of the 'minimumAge' field */
    public org.gel.models.report.avro.AgeRange.Builder setMinimumAge(int value) {
      validate(fields()[0], value);
      this.minimumAge = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'minimumAge' field has been set */
    public boolean hasMinimumAge() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'minimumAge' field */
    public org.gel.models.report.avro.AgeRange.Builder clearMinimumAge() {
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'maximumAge' field */
    public java.lang.Integer getMaximumAge() {
      return maximumAge;
    }
    
    /** Sets the value of the 'maximumAge' field */
    public org.gel.models.report.avro.AgeRange.Builder setMaximumAge(int value) {
      validate(fields()[1], value);
      this.maximumAge = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'maximumAge' field has been set */
    public boolean hasMaximumAge() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'maximumAge' field */
    public org.gel.models.report.avro.AgeRange.Builder clearMaximumAge() {
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'timeunit' field */
    public org.gel.models.report.avro.TimeUnit getTimeunit() {
      return timeunit;
    }
    
    /** Sets the value of the 'timeunit' field */
    public org.gel.models.report.avro.AgeRange.Builder setTimeunit(org.gel.models.report.avro.TimeUnit value) {
      validate(fields()[2], value);
      this.timeunit = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'timeunit' field has been set */
    public boolean hasTimeunit() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'timeunit' field */
    public org.gel.models.report.avro.AgeRange.Builder clearTimeunit() {
      timeunit = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public AgeRange build() {
      try {
        AgeRange record = new AgeRange();
        record.minimumAge = fieldSetFlags()[0] ? this.minimumAge : (java.lang.Integer) defaultValue(fields()[0]);
        record.maximumAge = fieldSetFlags()[1] ? this.maximumAge : (java.lang.Integer) defaultValue(fields()[1]);
        record.timeunit = fieldSetFlags()[2] ? this.timeunit : (org.gel.models.report.avro.TimeUnit) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy