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

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

/**
 * 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 NewCar extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 2175077066345540306L;


  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"NewCar\",\"namespace\":\"org.apache.parquet.avro\",\"fields\":[{\"name\":\"year\",\"type\":\"long\"},{\"name\":\"registration\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"brand\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"aliases\":[\"make\"]},{\"name\":\"model\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"vin\",\"type\":{\"type\":\"fixed\",\"name\":\"Vin\",\"size\":17}},{\"name\":\"doors\",\"type\":\"long\"},{\"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},{\"name\":\"opt\",\"type\":\"int\",\"default\":5},{\"name\":\"description\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static final 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 NewCar 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 NewCar from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a NewCar 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 NewCar 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 brand;
  private java.lang.String model;
  private org.apache.parquet.avro.Vin vin;
  private long doors;
  private org.apache.parquet.avro.Engine engine;
  private java.lang.Object optionalExtra;
  private java.util.List serviceHistory;
  private int opt;
  private java.lang.String description;

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

  /**
   * All-args constructor.
   * @param year The new value for year
   * @param registration The new value for registration
   * @param brand The new value for brand
   * @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
   * @param opt The new value for opt
   * @param description The new value for description
   */
  public NewCar(java.lang.Long year, java.lang.String registration, java.lang.String brand, java.lang.String model, org.apache.parquet.avro.Vin vin, java.lang.Long doors, org.apache.parquet.avro.Engine engine, java.lang.Object optionalExtra, java.util.List serviceHistory, java.lang.Integer opt, java.lang.String description) {
    this.year = year;
    this.registration = registration;
    this.brand = brand;
    this.model = model;
    this.vin = vin;
    this.doors = doors;
    this.engine = engine;
    this.optionalExtra = optionalExtra;
    this.serviceHistory = serviceHistory;
    this.opt = opt;
    this.description = description;
  }

  @Override
  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }

  @Override
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }

  // Used by DatumWriter.  Applications should not call.
  @Override
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return year;
    case 1: return registration;
    case 2: return brand;
    case 3: return model;
    case 4: return vin;
    case 5: return doors;
    case 6: return engine;
    case 7: return optionalExtra;
    case 8: return serviceHistory;
    case 9: return opt;
    case 10: return description;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  // Used by DatumReader.  Applications should not call.
  @Override
  @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: brand = 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.Long)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;
    case 9: opt = (java.lang.Integer)value$; break;
    case 10: description = value$ != null ? value$.toString() : null; 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 'brand' field.
   * @return The value of the 'brand' field.
   */
  public java.lang.String getBrand() {
    return brand;
  }


  /**
   * Sets the value of the 'brand' field.
   * @param value the value to set.
   */
  public void setBrand(java.lang.String value) {
    this.brand = 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 long getDoors() {
    return doors;
  }


  /**
   * Sets the value of the 'doors' field.
   * @param value the value to set.
   */
  public void setDoors(long 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;
  }

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


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

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


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

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

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

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

  /**
   * RecordBuilder for NewCar 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 brand;
    private java.lang.String model;
    private org.apache.parquet.avro.Vin vin;
    private long 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;
    private int opt;
    private java.lang.String description;

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

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(org.apache.parquet.avro.NewCar.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.brand)) {
        this.brand = data().deepCopy(fields()[2].schema(), other.brand);
        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];
      }
      if (isValidValue(fields()[9], other.opt)) {
        this.opt = data().deepCopy(fields()[9].schema(), other.opt);
        fieldSetFlags()[9] = other.fieldSetFlags()[9];
      }
      if (isValidValue(fields()[10], other.description)) {
        this.description = data().deepCopy(fields()[10].schema(), other.description);
        fieldSetFlags()[10] = other.fieldSetFlags()[10];
      }
    }

    /**
     * Creates a Builder by copying an existing NewCar instance
     * @param other The existing instance to copy.
     */
    private Builder(org.apache.parquet.avro.NewCar other) {
      super(SCHEMA$, MODEL$);
      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.brand)) {
        this.brand = data().deepCopy(fields()[2].schema(), other.brand);
        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;
      }
      if (isValidValue(fields()[9], other.opt)) {
        this.opt = data().deepCopy(fields()[9].schema(), other.opt);
        fieldSetFlags()[9] = true;
      }
      if (isValidValue(fields()[10], other.description)) {
        this.description = data().deepCopy(fields()[10].schema(), other.description);
        fieldSetFlags()[10] = 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.NewCar.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.NewCar.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.NewCar.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.NewCar.Builder clearRegistration() {
      registration = null;
      fieldSetFlags()[1] = false;
      return this;
    }

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


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

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


    /**
      * Clears the value of the 'brand' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.NewCar.Builder clearBrand() {
      brand = 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.NewCar.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.NewCar.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.NewCar.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.NewCar.Builder clearVin() {
      vin = null;
      fieldSetFlags()[4] = false;
      return this;
    }

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


    /**
      * Sets the value of the 'doors' field.
      * @param value The value of 'doors'.
      * @return This builder.
      */
    public org.apache.parquet.avro.NewCar.Builder setDoors(long 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.NewCar.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.NewCar.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.NewCar.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.NewCar.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.NewCar.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.NewCar.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.NewCar.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.NewCar.Builder clearServiceHistory() {
      serviceHistory = null;
      fieldSetFlags()[8] = false;
      return this;
    }

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


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

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


    /**
      * Clears the value of the 'opt' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.NewCar.Builder clearOpt() {
      fieldSetFlags()[9] = false;
      return this;
    }

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


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

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


    /**
      * Clears the value of the 'description' field.
      * @return This builder.
      */
    public org.apache.parquet.avro.NewCar.Builder clearDescription() {
      description = null;
      fieldSetFlags()[10] = false;
      return this;
    }

    @Override
    @SuppressWarnings("unchecked")
    public NewCar build() {
      try {
        NewCar record = new NewCar();
        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.brand = fieldSetFlags()[2] ? this.brand : (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.Long) 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]);
        record.opt = fieldSetFlags()[9] ? this.opt : (java.lang.Integer) defaultValue(fields()[9]);
        record.description = fieldSetFlags()[10] ? this.description : (java.lang.String) defaultValue(fields()[10]);
        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