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

org.apache.parquet.avro.Stereo Maven / Gradle / Ivy

There is a newer version: 1.14.4
Show newest version
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.apache.parquet.avro;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Stereo 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\":\"Stereo\",\"namespace\":\"org.apache.parquet.avro\",\"fields\":[{\"name\":\"make\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"speakers\",\"type\":\"int\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public java.lang.String make;
  @Deprecated public int speakers;

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

  /**
   * All-args constructor.
   */
  public Stereo(java.lang.String make, java.lang.Integer speakers) {
    this.make = make;
    this.speakers = speakers;
  }

  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 make;
    case 1: return speakers;
    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: make = (java.lang.String)value$; break;
    case 1: speakers = (java.lang.Integer)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

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

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

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

    private java.lang.String make;
    private int speakers;

    /** Creates a new Builder */
    private Builder() {
      super(org.apache.parquet.avro.Stereo.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.apache.parquet.avro.Stereo.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.make)) {
        this.make = data().deepCopy(fields()[0].schema(), other.make);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.speakers)) {
        this.speakers = data().deepCopy(fields()[1].schema(), other.speakers);
        fieldSetFlags()[1] = true;
      }
    }
    
    /** Creates a Builder by copying an existing Stereo instance */
    private Builder(org.apache.parquet.avro.Stereo other) {
            super(org.apache.parquet.avro.Stereo.SCHEMA$);
      if (isValidValue(fields()[0], other.make)) {
        this.make = data().deepCopy(fields()[0].schema(), other.make);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.speakers)) {
        this.speakers = data().deepCopy(fields()[1].schema(), other.speakers);
        fieldSetFlags()[1] = true;
      }
    }

    /** Gets the value of the 'make' field */
    public java.lang.String getMake() {
      return make;
    }
    
    /** Sets the value of the 'make' field */
    public org.apache.parquet.avro.Stereo.Builder setMake(java.lang.String value) {
      validate(fields()[0], value);
      this.make = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'make' field has been set */
    public boolean hasMake() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'make' field */
    public org.apache.parquet.avro.Stereo.Builder clearMake() {
      make = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'speakers' field */
    public java.lang.Integer getSpeakers() {
      return speakers;
    }
    
    /** Sets the value of the 'speakers' field */
    public org.apache.parquet.avro.Stereo.Builder setSpeakers(int value) {
      validate(fields()[1], value);
      this.speakers = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'speakers' field has been set */
    public boolean hasSpeakers() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'speakers' field */
    public org.apache.parquet.avro.Stereo.Builder clearSpeakers() {
      fieldSetFlags()[1] = false;
      return this;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy