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

org.apache.parquet.avro.Car 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;

import org.apache.avro.generic.GenericArray;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.util.Utf8;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;

@org.apache.avro.specific.AvroGenerated
public class Car extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 2576634117214334714L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Car\",\"namespace\":\"org.apache.parquet.avro\",\"fields\":[{\"name\":\"year\",\"type\":\"long\"},{\"name\":\"registration\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"make\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"model\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"vin\",\"type\":{\"type\":\"fixed\",\"name\":\"Vin\",\"size\":17}},{\"name\":\"doors\",\"type\":\"int\"},{\"name\":\"engine\",\"type\":{\"type\":\"record\",\"name\":\"Engine\",\"fields\":[{\"name\":\"type\",\"type\":{\"type\":\"enum\",\"name\":\"EngineType\",\"symbols\":[\"DIESEL\",\"PETROL\",\"ELECTRIC\"]}},{\"name\":\"capacity\",\"type\":\"float\"},{\"name\":\"hasTurboCharger\",\"type\":\"boolean\"}]}},{\"name\":\"optionalExtra\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"Stereo\",\"fields\":[{\"name\":\"make\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"speakers\",\"type\":\"int\"}]},{\"type\":\"record\",\"name\":\"LeatherTrim\",\"fields\":[{\"name\":\"colour\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}],\"default\":null},{\"name\":\"serviceHistory\",\"type\":[\"null\",{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"Service\",\"fields\":[{\"name\":\"date\",\"type\":\"long\"},{\"name\":\"mechanic\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}}],\"default\":null}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static SpecificData MODEL$ = new SpecificData();

  private static final BinaryMessageEncoder ENCODER =
      new BinaryMessageEncoder(MODEL$, SCHEMA$);

  private static final BinaryMessageDecoder DECODER =
      new BinaryMessageDecoder(MODEL$, SCHEMA$);

  /**
   * Return the BinaryMessageEncoder instance used by this class.
   * @return the message encoder used by this class
   */
  public static BinaryMessageEncoder getEncoder() {
    return ENCODER;
  }

  /**
   * Return the BinaryMessageDecoder instance used by this class.
   * @return the message decoder used by this class
   */
  public static BinaryMessageDecoder getDecoder() {
    return DECODER;
  }

  /**
   * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
   * @param resolver a {@link SchemaStore} used to find schemas by fingerprint
   * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
   */
  public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
    return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
  }

  /**
   * Serializes this Car to a ByteBuffer.
   * @return a buffer holding the serialized data for this instance
   * @throws java.io.IOException if this instance could not be serialized
   */
  public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
    return ENCODER.encode(this);
  }

  /**
   * Deserializes a Car from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a Car instance decoded from the given buffer
   * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
   */
  public static Car fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

   private long year;
   private java.lang.String registration;
   private java.lang.String make;
   private java.lang.String model;
   private org.apache.parquet.avro.Vin vin;
   private int doors;
   private org.apache.parquet.avro.Engine engine;
   private java.lang.Object optionalExtra;
   private java.util.List serviceHistory;

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

  /**
   * All-args constructor.
   * @param year The new value for year
   * @param registration The new value for registration
   * @param make The new value for make
   * @param model The new value for model
   * @param vin The new value for vin
   * @param doors The new value for doors
   * @param engine The new value for engine
   * @param optionalExtra The new value for optionalExtra
   * @param serviceHistory The new value for serviceHistory
   */
  public Car(java.lang.Long year, java.lang.String registration, java.lang.String make, java.lang.String model, org.apache.parquet.avro.Vin vin, java.lang.Integer doors, org.apache.parquet.avro.Engine engine, java.lang.Object optionalExtra, java.util.List serviceHistory) {
    this.year = year;
    this.registration = registration;
    this.make = make;
    this.model = model;
    this.vin = vin;
    this.doors = doors;
    this.engine = engine;
    this.optionalExtra = optionalExtra;
    this.serviceHistory = serviceHistory;
  }

  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
  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 year;
    case 1: return registration;
    case 2: return make;
    case 3: return model;
    case 4: return vin;
    case 5: return doors;
    case 6: return engine;
    case 7: return optionalExtra;
    case 8: return serviceHistory;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: year = (java.lang.Long)value$; break;
    case 1: registration = value$ != null ? value$.toString() : null; break;
    case 2: make = value$ != null ? value$.toString() : null; break;
    case 3: model = value$ != null ? value$.toString() : null; break;
    case 4: vin = (org.apache.parquet.avro.Vin)value$; break;
    case 5: doors = (java.lang.Integer)value$; break;
    case 6: engine = (org.apache.parquet.avro.Engine)value$; break;
    case 7: optionalExtra = value$; break;
    case 8: serviceHistory = (java.util.List)value$; break;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  /**
   * Gets the value of the 'year' field.
   * @return The value of the 'year' field.
   */
  public long getYear() {
    return year;
  }


  /**
   * Sets the value of the 'year' field.
   * @param value the value to set.
   */
  public void setYear(long value) {
    this.year = value;
  }

  /**
   * Gets the value of the 'registration' field.
   * @return The value of the 'registration' field.
   */
  public java.lang.String getRegistration() {
    return registration;
  }


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

  /**
   * Gets the value of the 'make' field.
   * @return 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 'model' field.
   * @return The value of the 'model' field.
   */
  public java.lang.String getModel() {
    return model;
  }


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

  /**
   * Gets the value of the 'vin' field.
   * @return The value of the 'vin' field.
   */
  public org.apache.parquet.avro.Vin getVin() {
    return vin;
  }


  /**
   * Sets the value of the 'vin' field.
   * @param value the value to set.
   */
  public void setVin(org.apache.parquet.avro.Vin value) {
    this.vin = value;
  }

  /**
   * Gets the value of the 'doors' field.
   * @return The value of the 'doors' field.
   */
  public int getDoors() {
    return doors;
  }


  /**
   * Sets the value of the 'doors' field.
   * @param value the value to set.
   */
  public void setDoors(int value) {
    this.doors = value;
  }

  /**
   * Gets the value of the 'engine' field.
   * @return The value of the 'engine' field.
   */
  public org.apache.parquet.avro.Engine getEngine() {
    return engine;
  }


  /**
   * Sets the value of the 'engine' field.
   * @param value the value to set.
   */
  public void setEngine(org.apache.parquet.avro.Engine value) {
    this.engine = value;
  }

  /**
   * Gets the value of the 'optionalExtra' field.
   * @return The value of the 'optionalExtra' field.
   */
  public java.lang.Object getOptionalExtra() {
    return optionalExtra;
  }


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

  /**
   * Gets the value of the 'serviceHistory' field.
   * @return The value of the 'serviceHistory' field.
   */
  public java.util.List getServiceHistory() {
    return serviceHistory;
  }


  /**
   * Sets the value of the 'serviceHistory' field.
   * @param value the value to set.
   */
  public void setServiceHistory(java.util.List value) {
    this.serviceHistory = value;
  }

  /**
   * Creates a new Car RecordBuilder.
   * @return A new Car RecordBuilder
   */
  public static org.apache.parquet.avro.Car.Builder newBuilder() {
    return new org.apache.parquet.avro.Car.Builder();
  }

  /**
   * Creates a new Car RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new Car RecordBuilder
   */
  public static org.apache.parquet.avro.Car.Builder newBuilder(org.apache.parquet.avro.Car.Builder other) {
    if (other == null) {
      return new org.apache.parquet.avro.Car.Builder();
    } else {
      return new org.apache.parquet.avro.Car.Builder(other);
    }
  }

  /**
   * Creates a new Car RecordBuilder by copying an existing Car instance.
   * @param other The existing instance to copy.
   * @return A new Car RecordBuilder
   */
  public static org.apache.parquet.avro.Car.Builder newBuilder(org.apache.parquet.avro.Car other) {
    if (other == null) {
      return new org.apache.parquet.avro.Car.Builder();
    } else {
      return new org.apache.parquet.avro.Car.Builder(other);
    }
  }

  /**
   * RecordBuilder for Car instances.
   */
  @org.apache.avro.specific.AvroGenerated
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
    implements org.apache.avro.data.RecordBuilder {

    private long year;
    private java.lang.String registration;
    private java.lang.String make;
    private java.lang.String model;
    private org.apache.parquet.avro.Vin vin;
    private int doors;
    private org.apache.parquet.avro.Engine engine;
    private org.apache.parquet.avro.Engine.Builder engineBuilder;
    private java.lang.Object optionalExtra;
    private java.util.List serviceHistory;

    /** Creates a new Builder */
    private Builder() {
      super(SCHEMA$);
    }

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(org.apache.parquet.avro.Car.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.year)) {
        this.year = data().deepCopy(fields()[0].schema(), other.year);
        fieldSetFlags()[0] = other.fieldSetFlags()[0];
      }
      if (isValidValue(fields()[1], other.registration)) {
        this.registration = data().deepCopy(fields()[1].schema(), other.registration);
        fieldSetFlags()[1] = other.fieldSetFlags()[1];
      }
      if (isValidValue(fields()[2], other.make)) {
        this.make = data().deepCopy(fields()[2].schema(), other.make);
        fieldSetFlags()[2] = other.fieldSetFlags()[2];
      }
      if (isValidValue(fields()[3], other.model)) {
        this.model = data().deepCopy(fields()[3].schema(), other.model);
        fieldSetFlags()[3] = other.fieldSetFlags()[3];
      }
      if (isValidValue(fields()[4], other.vin)) {
        this.vin = data().deepCopy(fields()[4].schema(), other.vin);
        fieldSetFlags()[4] = other.fieldSetFlags()[4];
      }
      if (isValidValue(fields()[5], other.doors)) {
        this.doors = data().deepCopy(fields()[5].schema(), other.doors);
        fieldSetFlags()[5] = other.fieldSetFlags()[5];
      }
      if (isValidValue(fields()[6], other.engine)) {
        this.engine = data().deepCopy(fields()[6].schema(), other.engine);
        fieldSetFlags()[6] = other.fieldSetFlags()[6];
      }
      if (other.hasEngineBuilder()) {
        this.engineBuilder = org.apache.parquet.avro.Engine.newBuilder(other.getEngineBuilder());
      }
      if (isValidValue(fields()[7], other.optionalExtra)) {
        this.optionalExtra = data().deepCopy(fields()[7].schema(), other.optionalExtra);
        fieldSetFlags()[7] = other.fieldSetFlags()[7];
      }
      if (isValidValue(fields()[8], other.serviceHistory)) {
        this.serviceHistory = data().deepCopy(fields()[8].schema(), other.serviceHistory);
        fieldSetFlags()[8] = other.fieldSetFlags()[8];
      }
    }

    /**
     * Creates a Builder by copying an existing Car instance
     * @param other The existing instance to copy.
     */
    private Builder(org.apache.parquet.avro.Car other) {
      super(SCHEMA$);
      if (isValidValue(fields()[0], other.year)) {
        this.year = data().deepCopy(fields()[0].schema(), other.year);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.registration)) {
        this.registration = data().deepCopy(fields()[1].schema(), other.registration);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.make)) {
        this.make = data().deepCopy(fields()[2].schema(), other.make);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.model)) {
        this.model = data().deepCopy(fields()[3].schema(), other.model);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.vin)) {
        this.vin = data().deepCopy(fields()[4].schema(), other.vin);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.doors)) {
        this.doors = data().deepCopy(fields()[5].schema(), other.doors);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.engine)) {
        this.engine = data().deepCopy(fields()[6].schema(), other.engine);
        fieldSetFlags()[6] = true;
      }
      this.engineBuilder = null;
      if (isValidValue(fields()[7], other.optionalExtra)) {
        this.optionalExtra = data().deepCopy(fields()[7].schema(), other.optionalExtra);
        fieldSetFlags()[7] = true;
      }
      if (isValidValue(fields()[8], other.serviceHistory)) {
        this.serviceHistory = data().deepCopy(fields()[8].schema(), other.serviceHistory);
        fieldSetFlags()[8] = true;
      }
    }

    /**
      * Gets the value of the 'year' field.
      * @return The value.
      */
    public long getYear() {
      return year;
    }


    /**
      * Sets the value of the 'year' field.
      * @param value The value of 'year'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setYear(long value) {
      validate(fields()[0], value);
      this.year = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /**
      * Checks whether the 'year' field has been set.
      * @return True if the 'year' field has been set, false otherwise.
      */
    public boolean hasYear() {
      return fieldSetFlags()[0];
    }


    /**
      * Clears the value of the 'year' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearYear() {
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'registration' field.
      * @return The value.
      */
    public java.lang.String getRegistration() {
      return registration;
    }


    /**
      * Sets the value of the 'registration' field.
      * @param value The value of 'registration'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setRegistration(java.lang.String value) {
      validate(fields()[1], value);
      this.registration = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /**
      * Checks whether the 'registration' field has been set.
      * @return True if the 'registration' field has been set, false otherwise.
      */
    public boolean hasRegistration() {
      return fieldSetFlags()[1];
    }


    /**
      * Clears the value of the 'registration' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearRegistration() {
      registration = null;
      fieldSetFlags()[1] = false;
      return this;
    }

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


    /**
      * Sets the value of the 'make' field.
      * @param value The value of 'make'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setMake(java.lang.String value) {
      validate(fields()[2], value);
      this.make = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /**
      * Checks whether the 'make' field has been set.
      * @return True if the 'make' field has been set, false otherwise.
      */
    public boolean hasMake() {
      return fieldSetFlags()[2];
    }


    /**
      * Clears the value of the 'make' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearMake() {
      make = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'model' field.
      * @return The value.
      */
    public java.lang.String getModel() {
      return model;
    }


    /**
      * Sets the value of the 'model' field.
      * @param value The value of 'model'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setModel(java.lang.String value) {
      validate(fields()[3], value);
      this.model = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /**
      * Checks whether the 'model' field has been set.
      * @return True if the 'model' field has been set, false otherwise.
      */
    public boolean hasModel() {
      return fieldSetFlags()[3];
    }


    /**
      * Clears the value of the 'model' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearModel() {
      model = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /**
      * Gets the value of the 'vin' field.
      * @return The value.
      */
    public org.apache.parquet.avro.Vin getVin() {
      return vin;
    }


    /**
      * Sets the value of the 'vin' field.
      * @param value The value of 'vin'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setVin(org.apache.parquet.avro.Vin value) {
      validate(fields()[4], value);
      this.vin = value;
      fieldSetFlags()[4] = true;
      return this;
    }

    /**
      * Checks whether the 'vin' field has been set.
      * @return True if the 'vin' field has been set, false otherwise.
      */
    public boolean hasVin() {
      return fieldSetFlags()[4];
    }


    /**
      * Clears the value of the 'vin' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearVin() {
      vin = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /**
      * Gets the value of the 'doors' field.
      * @return The value.
      */
    public int getDoors() {
      return doors;
    }


    /**
      * Sets the value of the 'doors' field.
      * @param value The value of 'doors'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setDoors(int value) {
      validate(fields()[5], value);
      this.doors = value;
      fieldSetFlags()[5] = true;
      return this;
    }

    /**
      * Checks whether the 'doors' field has been set.
      * @return True if the 'doors' field has been set, false otherwise.
      */
    public boolean hasDoors() {
      return fieldSetFlags()[5];
    }


    /**
      * Clears the value of the 'doors' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearDoors() {
      fieldSetFlags()[5] = false;
      return this;
    }

    /**
      * Gets the value of the 'engine' field.
      * @return The value.
      */
    public org.apache.parquet.avro.Engine getEngine() {
      return engine;
    }


    /**
      * Sets the value of the 'engine' field.
      * @param value The value of 'engine'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setEngine(org.apache.parquet.avro.Engine value) {
      validate(fields()[6], value);
      this.engineBuilder = null;
      this.engine = value;
      fieldSetFlags()[6] = true;
      return this;
    }

    /**
      * Checks whether the 'engine' field has been set.
      * @return True if the 'engine' field has been set, false otherwise.
      */
    public boolean hasEngine() {
      return fieldSetFlags()[6];
    }

    /**
     * Gets the Builder instance for the 'engine' field and creates one if it doesn't exist yet.
     * @return This builder.
     */
    public org.apache.parquet.avro.Engine.Builder getEngineBuilder() {
      if (engineBuilder == null) {
        if (hasEngine()) {
          setEngineBuilder(org.apache.parquet.avro.Engine.newBuilder(engine));
        } else {
          setEngineBuilder(org.apache.parquet.avro.Engine.newBuilder());
        }
      }
      return engineBuilder;
    }

    /**
     * Sets the Builder instance for the 'engine' field
     * @param value The builder instance that must be set.
     * @return This builder.
     */

    public org.apache.parquet.avro.Car.Builder setEngineBuilder(org.apache.parquet.avro.Engine.Builder value) {
      clearEngine();
      engineBuilder = value;
      return this;
    }

    /**
     * Checks whether the 'engine' field has an active Builder instance
     * @return True if the 'engine' field has an active Builder instance
     */
    public boolean hasEngineBuilder() {
      return engineBuilder != null;
    }

    /**
      * Clears the value of the 'engine' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearEngine() {
      engine = null;
      engineBuilder = null;
      fieldSetFlags()[6] = false;
      return this;
    }

    /**
      * Gets the value of the 'optionalExtra' field.
      * @return The value.
      */
    public java.lang.Object getOptionalExtra() {
      return optionalExtra;
    }


    /**
      * Sets the value of the 'optionalExtra' field.
      * @param value The value of 'optionalExtra'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setOptionalExtra(java.lang.Object value) {
      validate(fields()[7], value);
      this.optionalExtra = value;
      fieldSetFlags()[7] = true;
      return this;
    }

    /**
      * Checks whether the 'optionalExtra' field has been set.
      * @return True if the 'optionalExtra' field has been set, false otherwise.
      */
    public boolean hasOptionalExtra() {
      return fieldSetFlags()[7];
    }


    /**
      * Clears the value of the 'optionalExtra' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearOptionalExtra() {
      optionalExtra = null;
      fieldSetFlags()[7] = false;
      return this;
    }

    /**
      * Gets the value of the 'serviceHistory' field.
      * @return The value.
      */
    public java.util.List getServiceHistory() {
      return serviceHistory;
    }


    /**
      * Sets the value of the 'serviceHistory' field.
      * @param value The value of 'serviceHistory'.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder setServiceHistory(java.util.List value) {
      validate(fields()[8], value);
      this.serviceHistory = value;
      fieldSetFlags()[8] = true;
      return this;
    }

    /**
      * Checks whether the 'serviceHistory' field has been set.
      * @return True if the 'serviceHistory' field has been set, false otherwise.
      */
    public boolean hasServiceHistory() {
      return fieldSetFlags()[8];
    }


    /**
      * Clears the value of the 'serviceHistory' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.Car.Builder clearServiceHistory() {
      serviceHistory = null;
      fieldSetFlags()[8] = false;
      return this;
    }

    @Override
    @SuppressWarnings("unchecked")
    public Car build() {
      try {
        Car record = new Car();
        record.year = fieldSetFlags()[0] ? this.year : (java.lang.Long) defaultValue(fields()[0]);
        record.registration = fieldSetFlags()[1] ? this.registration : (java.lang.String) defaultValue(fields()[1]);
        record.make = fieldSetFlags()[2] ? this.make : (java.lang.String) defaultValue(fields()[2]);
        record.model = fieldSetFlags()[3] ? this.model : (java.lang.String) defaultValue(fields()[3]);
        record.vin = fieldSetFlags()[4] ? this.vin : (org.apache.parquet.avro.Vin) defaultValue(fields()[4]);
        record.doors = fieldSetFlags()[5] ? this.doors : (java.lang.Integer) defaultValue(fields()[5]);
        if (engineBuilder != null) {
          try {
            record.engine = this.engineBuilder.build();
          } catch (org.apache.avro.AvroMissingFieldException e) {
            e.addParentField(record.getSchema().getField("engine"));
            throw e;
          }
        } else {
          record.engine = fieldSetFlags()[6] ? this.engine : (org.apache.parquet.avro.Engine) defaultValue(fields()[6]);
        }
        record.optionalExtra = fieldSetFlags()[7] ? this.optionalExtra :  defaultValue(fields()[7]);
        record.serviceHistory = fieldSetFlags()[8] ? this.serviceHistory : (java.util.List) defaultValue(fields()[8]);
        return record;
      } catch (org.apache.avro.AvroMissingFieldException e) {
        throw e;
      } catch (java.lang.Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumWriter
    WRITER$ = (org.apache.avro.io.DatumWriter)MODEL$.createDatumWriter(SCHEMA$);

  @Override public void writeExternal(java.io.ObjectOutput out)
    throws java.io.IOException {
    WRITER$.write(this, SpecificData.getEncoder(out));
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumReader
    READER$ = (org.apache.avro.io.DatumReader)MODEL$.createDatumReader(SCHEMA$);

  @Override public void readExternal(java.io.ObjectInput in)
    throws java.io.IOException {
    READER$.read(this, SpecificData.getDecoder(in));
  }

}














© 2015 - 2024 Weber Informatics LLC | Privacy Policy