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

me.tfeng.playmods.oauth2.Authentication Maven / Gradle / Ivy

/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package me.tfeng.playmods.oauth2;

import org.apache.avro.specific.SpecificData;

@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Authentication extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = -7398716255179213276L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Authentication\",\"namespace\":\"me.tfeng.playmods.oauth2\",\"fields\":[{\"name\":\"client\",\"type\":{\"type\":\"record\",\"name\":\"ClientAuthentication\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"authorities\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}},{\"name\":\"scopes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}}]}},{\"name\":\"user\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"UserAuthentication\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"authorities\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}}]}]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public me.tfeng.playmods.oauth2.ClientAuthentication client;
  @Deprecated public me.tfeng.playmods.oauth2.UserAuthentication user;

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

  /**
   * All-args constructor.
   * @param client The new value for client
   * @param user The new value for user
   */
  public Authentication(me.tfeng.playmods.oauth2.ClientAuthentication client, me.tfeng.playmods.oauth2.UserAuthentication user) {
    this.client = client;
    this.user = user;
  }

  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 client;
    case 1: return user;
    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: client = (me.tfeng.playmods.oauth2.ClientAuthentication)value$; break;
    case 1: user = (me.tfeng.playmods.oauth2.UserAuthentication)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'client' field.
   * @return The value of the 'client' field.
   */
  public me.tfeng.playmods.oauth2.ClientAuthentication getClient() {
    return client;
  }

  /**
   * Sets the value of the 'client' field.
   * @param value the value to set.
   */
  public void setClient(me.tfeng.playmods.oauth2.ClientAuthentication value) {
    this.client = value;
  }

  /**
   * Gets the value of the 'user' field.
   * @return The value of the 'user' field.
   */
  public me.tfeng.playmods.oauth2.UserAuthentication getUser() {
    return user;
  }

  /**
   * Sets the value of the 'user' field.
   * @param value the value to set.
   */
  public void setUser(me.tfeng.playmods.oauth2.UserAuthentication value) {
    this.user = value;
  }

  /**
   * Creates a new Authentication RecordBuilder.
   * @return A new Authentication RecordBuilder
   */
  public static me.tfeng.playmods.oauth2.Authentication.Builder newBuilder() {
    return new me.tfeng.playmods.oauth2.Authentication.Builder();
  }

  /**
   * Creates a new Authentication RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new Authentication RecordBuilder
   */
  public static me.tfeng.playmods.oauth2.Authentication.Builder newBuilder(me.tfeng.playmods.oauth2.Authentication.Builder other) {
    return new me.tfeng.playmods.oauth2.Authentication.Builder(other);
  }

  /**
   * Creates a new Authentication RecordBuilder by copying an existing Authentication instance.
   * @param other The existing instance to copy.
   * @return A new Authentication RecordBuilder
   */
  public static me.tfeng.playmods.oauth2.Authentication.Builder newBuilder(me.tfeng.playmods.oauth2.Authentication other) {
    return new me.tfeng.playmods.oauth2.Authentication.Builder(other);
  }

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

    private me.tfeng.playmods.oauth2.ClientAuthentication client;
    private me.tfeng.playmods.oauth2.ClientAuthentication.Builder clientBuilder;
    private me.tfeng.playmods.oauth2.UserAuthentication user;
    private me.tfeng.playmods.oauth2.UserAuthentication.Builder userBuilder;

    /** 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(me.tfeng.playmods.oauth2.Authentication.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.client)) {
        this.client = data().deepCopy(fields()[0].schema(), other.client);
        fieldSetFlags()[0] = true;
      }
      if (other.hasClientBuilder()) {
        this.clientBuilder = me.tfeng.playmods.oauth2.ClientAuthentication.newBuilder(other.getClientBuilder());
      }
      if (isValidValue(fields()[1], other.user)) {
        this.user = data().deepCopy(fields()[1].schema(), other.user);
        fieldSetFlags()[1] = true;
      }
      if (other.hasUserBuilder()) {
        this.userBuilder = me.tfeng.playmods.oauth2.UserAuthentication.newBuilder(other.getUserBuilder());
      }
    }

    /**
     * Creates a Builder by copying an existing Authentication instance
     * @param other The existing instance to copy.
     */
    private Builder(me.tfeng.playmods.oauth2.Authentication other) {
            super(SCHEMA$);
      if (isValidValue(fields()[0], other.client)) {
        this.client = data().deepCopy(fields()[0].schema(), other.client);
        fieldSetFlags()[0] = true;
      }
      this.clientBuilder = null;
      if (isValidValue(fields()[1], other.user)) {
        this.user = data().deepCopy(fields()[1].schema(), other.user);
        fieldSetFlags()[1] = true;
      }
      this.userBuilder = null;
    }

    /**
      * Gets the value of the 'client' field.
      * @return The value.
      */
    public me.tfeng.playmods.oauth2.ClientAuthentication getClient() {
      return client;
    }

    /**
      * Sets the value of the 'client' field.
      * @param value The value of 'client'.
      * @return This builder.
      */
    public me.tfeng.playmods.oauth2.Authentication.Builder setClient(me.tfeng.playmods.oauth2.ClientAuthentication value) {
      validate(fields()[0], value);
      this.clientBuilder = null;
      this.client = value;
      fieldSetFlags()[0] = true;
      return this;
    }

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

    /**
     * Gets the Builder instance for the 'client' field and creates one if it doesn't exist yet.
     * @return This builder.
     */
    public me.tfeng.playmods.oauth2.ClientAuthentication.Builder getClientBuilder() {
      if (clientBuilder == null) {
        if (hasClient()) {
          setClientBuilder(me.tfeng.playmods.oauth2.ClientAuthentication.newBuilder(client));
        } else {
          setClientBuilder(me.tfeng.playmods.oauth2.ClientAuthentication.newBuilder());
        }
      }
      return clientBuilder;
    }

    /**
     * Sets the Builder instance for the 'client' field
     * @param value The builder instance that must be set.
     * @return This builder.
     */
    public me.tfeng.playmods.oauth2.Authentication.Builder setClientBuilder(me.tfeng.playmods.oauth2.ClientAuthentication.Builder value) {
      clearClient();
      clientBuilder = value;
      return this;
    }

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

    /**
      * Clears the value of the 'client' field.
      * @return This builder.
      */
    public me.tfeng.playmods.oauth2.Authentication.Builder clearClient() {
      client = null;
      clientBuilder = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'user' field.
      * @return The value.
      */
    public me.tfeng.playmods.oauth2.UserAuthentication getUser() {
      return user;
    }

    /**
      * Sets the value of the 'user' field.
      * @param value The value of 'user'.
      * @return This builder.
      */
    public me.tfeng.playmods.oauth2.Authentication.Builder setUser(me.tfeng.playmods.oauth2.UserAuthentication value) {
      validate(fields()[1], value);
      this.userBuilder = null;
      this.user = value;
      fieldSetFlags()[1] = true;
      return this;
    }

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

    /**
     * Gets the Builder instance for the 'user' field and creates one if it doesn't exist yet.
     * @return This builder.
     */
    public me.tfeng.playmods.oauth2.UserAuthentication.Builder getUserBuilder() {
      if (userBuilder == null) {
        if (hasUser()) {
          setUserBuilder(me.tfeng.playmods.oauth2.UserAuthentication.newBuilder(user));
        } else {
          setUserBuilder(me.tfeng.playmods.oauth2.UserAuthentication.newBuilder());
        }
      }
      return userBuilder;
    }

    /**
     * Sets the Builder instance for the 'user' field
     * @param value The builder instance that must be set.
     * @return This builder.
     */
    public me.tfeng.playmods.oauth2.Authentication.Builder setUserBuilder(me.tfeng.playmods.oauth2.UserAuthentication.Builder value) {
      clearUser();
      userBuilder = value;
      return this;
    }

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

    /**
      * Clears the value of the 'user' field.
      * @return This builder.
      */
    public me.tfeng.playmods.oauth2.Authentication.Builder clearUser() {
      user = null;
      userBuilder = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    @Override
    public Authentication build() {
      try {
        Authentication record = new Authentication();
        if (clientBuilder != null) {
          record.client = this.clientBuilder.build();
        } else {
          record.client = fieldSetFlags()[0] ? this.client : (me.tfeng.playmods.oauth2.ClientAuthentication) defaultValue(fields()[0]);
        }
        if (userBuilder != null) {
          record.user = this.userBuilder.build();
        } else {
          record.user = fieldSetFlags()[1] ? this.user : (me.tfeng.playmods.oauth2.UserAuthentication) 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