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

Energistics.Protocol.DataArray.DataArray Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package Energistics.Protocol.DataArray;

import org.apache.avro.specific.SpecificData;

@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class DataArray extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 637261203103740922L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"DataArray\",\"namespace\":\"Energistics.Protocol.DataArray\",\"fields\":[{\"name\":\"dimensions\",\"type\":{\"type\":\"array\",\"items\":\"long\"}},{\"name\":\"data\",\"type\":{\"type\":\"record\",\"name\":\"AnyArray\",\"namespace\":\"Energistics.Datatypes\",\"fields\":[{\"name\":\"item\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"ArrayOfBoolean\",\"fields\":[{\"name\":\"values\",\"type\":{\"type\":\"array\",\"items\":\"boolean\"}}],\"fullName\":\"Energistics.Datatypes.ArrayOfBoolean\",\"depends\":[]},\"bytes\",{\"type\":\"record\",\"name\":\"ArrayOfInt\",\"fields\":[{\"name\":\"values\",\"type\":{\"type\":\"array\",\"items\":\"int\"}}],\"fullName\":\"Energistics.Datatypes.ArrayOfInt\",\"depends\":[]},{\"type\":\"record\",\"name\":\"ArrayOfLong\",\"fields\":[{\"name\":\"values\",\"type\":{\"type\":\"array\",\"items\":\"long\"}}],\"fullName\":\"Energistics.Datatypes.ArrayOfLong\",\"depends\":[]},{\"type\":\"record\",\"name\":\"ArrayOfFloat\",\"fields\":[{\"name\":\"values\",\"type\":{\"type\":\"array\",\"items\":\"float\"}}],\"fullName\":\"Energistics.Datatypes.ArrayOfFloat\",\"depends\":[]},{\"type\":\"record\",\"name\":\"ArrayOfDouble\",\"fields\":[{\"name\":\"values\",\"type\":{\"type\":\"array\",\"items\":\"double\"}}],\"fullName\":\"Energistics.Datatypes.ArrayOfDouble\",\"depends\":[]}]}],\"fullName\":\"Energistics.Datatypes.AnyArray\",\"depends\":[\"Energistics.Datatypes.ArrayOfBoolean\",\"Energistics.Datatypes.ArrayOfInt\",\"Energistics.Datatypes.ArrayOfLong\",\"Energistics.Datatypes.ArrayOfFloat\",\"Energistics.Datatypes.ArrayOfDouble\"]}}],\"messageType\":\"1\",\"protocol\":\"7\",\"senderRole\":\"store\",\"protocolRoles\":\"store,customer\",\"fullName\":\"Energistics.Protocol.DataArray.DataArray\",\"depends\":[\"Energistics.Datatypes.AnyArray\"]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public java.util.List dimensions;
  @Deprecated public Energistics.Datatypes.AnyArray data;

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

  /**
   * All-args constructor.
   * @param dimensions The new value for dimensions
   * @param data The new value for data
   */
  public DataArray(java.util.List dimensions, Energistics.Datatypes.AnyArray data) {
    this.dimensions = dimensions;
    this.data = data;
  }

  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 dimensions;
    case 1: return data;
    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: dimensions = (java.util.List)value$; break;
    case 1: data = (Energistics.Datatypes.AnyArray)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

  /**
   * Gets the value of the 'data' field.
   * @return The value of the 'data' field.
   */
  public Energistics.Datatypes.AnyArray getData() {
    return data;
  }

  /**
   * Sets the value of the 'data' field.
   * @param value the value to set.
   */
  public void setData(Energistics.Datatypes.AnyArray value) {
    this.data = value;
  }

  /**
   * Creates a new DataArray RecordBuilder.
   * @return A new DataArray RecordBuilder
   */
  public static Energistics.Protocol.DataArray.DataArray.Builder newBuilder() {
    return new Energistics.Protocol.DataArray.DataArray.Builder();
  }

  /**
   * Creates a new DataArray RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new DataArray RecordBuilder
   */
  public static Energistics.Protocol.DataArray.DataArray.Builder newBuilder(Energistics.Protocol.DataArray.DataArray.Builder other) {
    return new Energistics.Protocol.DataArray.DataArray.Builder(other);
  }

  /**
   * Creates a new DataArray RecordBuilder by copying an existing DataArray instance.
   * @param other The existing instance to copy.
   * @return A new DataArray RecordBuilder
   */
  public static Energistics.Protocol.DataArray.DataArray.Builder newBuilder(Energistics.Protocol.DataArray.DataArray other) {
    return new Energistics.Protocol.DataArray.DataArray.Builder(other);
  }

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

    private java.util.List dimensions;
    private Energistics.Datatypes.AnyArray data;
    private Energistics.Datatypes.AnyArray.Builder dataBuilder;

    /** 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(Energistics.Protocol.DataArray.DataArray.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.dimensions)) {
        this.dimensions = data().deepCopy(fields()[0].schema(), other.dimensions);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.data)) {
        this.data = data().deepCopy(fields()[1].schema(), other.data);
        fieldSetFlags()[1] = true;
      }
      if (other.hasDataBuilder()) {
        this.dataBuilder = Energistics.Datatypes.AnyArray.newBuilder(other.getDataBuilder());
      }
    }

    /**
     * Creates a Builder by copying an existing DataArray instance
     * @param other The existing instance to copy.
     */
    private Builder(Energistics.Protocol.DataArray.DataArray other) {
            super(SCHEMA$);
      if (isValidValue(fields()[0], other.dimensions)) {
        this.dimensions = data().deepCopy(fields()[0].schema(), other.dimensions);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.data)) {
        this.data = data().deepCopy(fields()[1].schema(), other.data);
        fieldSetFlags()[1] = true;
      }
      this.dataBuilder = null;
    }

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

    /**
      * Sets the value of the 'dimensions' field.
      * @param value The value of 'dimensions'.
      * @return This builder.
      */
    public Energistics.Protocol.DataArray.DataArray.Builder setDimensions(java.util.List value) {
      validate(fields()[0], value);
      this.dimensions = value;
      fieldSetFlags()[0] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'dimensions' field.
      * @return This builder.
      */
    public Energistics.Protocol.DataArray.DataArray.Builder clearDimensions() {
      dimensions = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'data' field.
      * @return The value.
      */
    public Energistics.Datatypes.AnyArray getData() {
      return data;
    }

    /**
      * Sets the value of the 'data' field.
      * @param value The value of 'data'.
      * @return This builder.
      */
    public Energistics.Protocol.DataArray.DataArray.Builder setData(Energistics.Datatypes.AnyArray value) {
      validate(fields()[1], value);
      this.dataBuilder = null;
      this.data = value;
      fieldSetFlags()[1] = true;
      return this;
    }

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

    /**
     * Gets the Builder instance for the 'data' field and creates one if it doesn't exist yet.
     * @return This builder.
     */
    public Energistics.Datatypes.AnyArray.Builder getDataBuilder() {
      if (dataBuilder == null) {
        if (hasData()) {
          setDataBuilder(Energistics.Datatypes.AnyArray.newBuilder(data));
        } else {
          setDataBuilder(Energistics.Datatypes.AnyArray.newBuilder());
        }
      }
      return dataBuilder;
    }

    /**
     * Sets the Builder instance for the 'data' field
     * @param value The builder instance that must be set.
     * @return This builder.
     */
    public Energistics.Protocol.DataArray.DataArray.Builder setDataBuilder(Energistics.Datatypes.AnyArray.Builder value) {
      clearData();
      dataBuilder = value;
      return this;
    }

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

    /**
      * Clears the value of the 'data' field.
      * @return This builder.
      */
    public Energistics.Protocol.DataArray.DataArray.Builder clearData() {
      data = null;
      dataBuilder = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    @Override
    public DataArray build() {
      try {
        DataArray record = new DataArray();
        record.dimensions = fieldSetFlags()[0] ? this.dimensions : (java.util.List) defaultValue(fields()[0]);
        if (dataBuilder != null) {
          record.data = this.dataBuilder.build();
        } else {
          record.data = fieldSetFlags()[1] ? this.data : (Energistics.Datatypes.AnyArray) defaultValue(fields()[1]);
        }
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }

  private static final org.apache.avro.io.DatumWriter
    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);

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

  private static final org.apache.avro.io.DatumReader
    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy