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

org.apache.avro.ipc.HandshakeResponse Maven / Gradle / Ivy

/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package org.apache.avro.ipc;

import org.apache.avro.specific.SpecificData;

@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class HandshakeResponse extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 1055336403110395392L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HandshakeResponse\",\"namespace\":\"org.apache.avro.ipc\",\"fields\":[{\"name\":\"match\",\"type\":{\"type\":\"enum\",\"name\":\"HandshakeMatch\",\"symbols\":[\"BOTH\",\"CLIENT\",\"NONE\"]}},{\"name\":\"serverProtocol\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]},{\"name\":\"serverHash\",\"type\":[\"null\",{\"type\":\"fixed\",\"name\":\"MD5\",\"size\":16}]},{\"name\":\"meta\",\"type\":[\"null\",{\"type\":\"map\",\"values\":\"bytes\",\"avro.java.string\":\"String\"}]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public org.apache.avro.ipc.HandshakeMatch match;
  @Deprecated public java.lang.String serverProtocol;
  @Deprecated public org.apache.avro.ipc.MD5 serverHash;
  @Deprecated public java.util.Map meta;

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

  /**
   * All-args constructor.
   * @param match The new value for match
   * @param serverProtocol The new value for serverProtocol
   * @param serverHash The new value for serverHash
   * @param meta The new value for meta
   */
  public HandshakeResponse(org.apache.avro.ipc.HandshakeMatch match, java.lang.String serverProtocol, org.apache.avro.ipc.MD5 serverHash, java.util.Map meta) {
    this.match = match;
    this.serverProtocol = serverProtocol;
    this.serverHash = serverHash;
    this.meta = meta;
  }

  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 match;
    case 1: return serverProtocol;
    case 2: return serverHash;
    case 3: return meta;
    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: match = (org.apache.avro.ipc.HandshakeMatch)value$; break;
    case 1: serverProtocol = (java.lang.String)value$; break;
    case 2: serverHash = (org.apache.avro.ipc.MD5)value$; break;
    case 3: meta = (java.util.Map)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'match' field.
   * @return The value of the 'match' field.
   */
  public org.apache.avro.ipc.HandshakeMatch getMatch() {
    return match;
  }

  /**
   * Sets the value of the 'match' field.
   * @param value the value to set.
   */
  public void setMatch(org.apache.avro.ipc.HandshakeMatch value) {
    this.match = value;
  }

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

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

  /**
   * Gets the value of the 'serverHash' field.
   * @return The value of the 'serverHash' field.
   */
  public org.apache.avro.ipc.MD5 getServerHash() {
    return serverHash;
  }

  /**
   * Sets the value of the 'serverHash' field.
   * @param value the value to set.
   */
  public void setServerHash(org.apache.avro.ipc.MD5 value) {
    this.serverHash = value;
  }

  /**
   * Gets the value of the 'meta' field.
   * @return The value of the 'meta' field.
   */
  public java.util.Map getMeta() {
    return meta;
  }

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

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

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

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

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

    private org.apache.avro.ipc.HandshakeMatch match;
    private java.lang.String serverProtocol;
    private org.apache.avro.ipc.MD5 serverHash;
    private java.util.Map meta;

    /** 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.avro.ipc.HandshakeResponse.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.match)) {
        this.match = data().deepCopy(fields()[0].schema(), other.match);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.serverProtocol)) {
        this.serverProtocol = data().deepCopy(fields()[1].schema(), other.serverProtocol);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.serverHash)) {
        this.serverHash = data().deepCopy(fields()[2].schema(), other.serverHash);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.meta)) {
        this.meta = data().deepCopy(fields()[3].schema(), other.meta);
        fieldSetFlags()[3] = true;
      }
    }

    /**
     * Creates a Builder by copying an existing HandshakeResponse instance
     * @param other The existing instance to copy.
     */
    private Builder(org.apache.avro.ipc.HandshakeResponse other) {
            super(SCHEMA$);
      if (isValidValue(fields()[0], other.match)) {
        this.match = data().deepCopy(fields()[0].schema(), other.match);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.serverProtocol)) {
        this.serverProtocol = data().deepCopy(fields()[1].schema(), other.serverProtocol);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.serverHash)) {
        this.serverHash = data().deepCopy(fields()[2].schema(), other.serverHash);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.meta)) {
        this.meta = data().deepCopy(fields()[3].schema(), other.meta);
        fieldSetFlags()[3] = true;
      }
    }

    /**
      * Gets the value of the 'match' field.
      * @return The value.
      */
    public org.apache.avro.ipc.HandshakeMatch getMatch() {
      return match;
    }

    /**
      * Sets the value of the 'match' field.
      * @param value The value of 'match'.
      * @return This builder.
      */
    public org.apache.avro.ipc.HandshakeResponse.Builder setMatch(org.apache.avro.ipc.HandshakeMatch value) {
      validate(fields()[0], value);
      this.match = value;
      fieldSetFlags()[0] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'match' field.
      * @return This builder.
      */
    public org.apache.avro.ipc.HandshakeResponse.Builder clearMatch() {
      match = null;
      fieldSetFlags()[0] = false;
      return this;
    }

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

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

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


    /**
      * Clears the value of the 'serverProtocol' field.
      * @return This builder.
      */
    public org.apache.avro.ipc.HandshakeResponse.Builder clearServerProtocol() {
      serverProtocol = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /**
      * Gets the value of the 'serverHash' field.
      * @return The value.
      */
    public org.apache.avro.ipc.MD5 getServerHash() {
      return serverHash;
    }

    /**
      * Sets the value of the 'serverHash' field.
      * @param value The value of 'serverHash'.
      * @return This builder.
      */
    public org.apache.avro.ipc.HandshakeResponse.Builder setServerHash(org.apache.avro.ipc.MD5 value) {
      validate(fields()[2], value);
      this.serverHash = value;
      fieldSetFlags()[2] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'serverHash' field.
      * @return This builder.
      */
    public org.apache.avro.ipc.HandshakeResponse.Builder clearServerHash() {
      serverHash = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'meta' field.
      * @return The value.
      */
    public java.util.Map getMeta() {
      return meta;
    }

    /**
      * Sets the value of the 'meta' field.
      * @param value The value of 'meta'.
      * @return This builder.
      */
    public org.apache.avro.ipc.HandshakeResponse.Builder setMeta(java.util.Map value) {
      validate(fields()[3], value);
      this.meta = value;
      fieldSetFlags()[3] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'meta' field.
      * @return This builder.
      */
    public org.apache.avro.ipc.HandshakeResponse.Builder clearMeta() {
      meta = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    @Override
    public HandshakeResponse build() {
      try {
        HandshakeResponse record = new HandshakeResponse();
        record.match = fieldSetFlags()[0] ? this.match : (org.apache.avro.ipc.HandshakeMatch) defaultValue(fields()[0]);
        record.serverProtocol = fieldSetFlags()[1] ? this.serverProtocol : (java.lang.String) defaultValue(fields()[1]);
        record.serverHash = fieldSetFlags()[2] ? this.serverHash : (org.apache.avro.ipc.MD5) defaultValue(fields()[2]);
        record.meta = fieldSetFlags()[3] ? this.meta : (java.util.Map) defaultValue(fields()[3]);
        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