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

me.tfeng.play.security.oauth2.Authentication Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package me.tfeng.play.security.oauth2;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Authentication extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Authentication\",\"namespace\":\"me.tfeng.play.security.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.play.security.oauth2.ClientAuthentication client;
  @Deprecated public me.tfeng.play.security.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.
   */
  public Authentication(me.tfeng.play.security.oauth2.ClientAuthentication client, me.tfeng.play.security.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.play.security.oauth2.ClientAuthentication)value$; break;
    case 1: user = (me.tfeng.play.security.oauth2.UserAuthentication)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

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

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

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

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

  /** Creates a new Authentication RecordBuilder */
  public static me.tfeng.play.security.oauth2.Authentication.Builder newBuilder() {
    return new me.tfeng.play.security.oauth2.Authentication.Builder();
  }
  
  /** Creates a new Authentication RecordBuilder by copying an existing Builder */
  public static me.tfeng.play.security.oauth2.Authentication.Builder newBuilder(me.tfeng.play.security.oauth2.Authentication.Builder other) {
    return new me.tfeng.play.security.oauth2.Authentication.Builder(other);
  }
  
  /** Creates a new Authentication RecordBuilder by copying an existing Authentication instance */
  public static me.tfeng.play.security.oauth2.Authentication.Builder newBuilder(me.tfeng.play.security.oauth2.Authentication other) {
    return new me.tfeng.play.security.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.play.security.oauth2.ClientAuthentication client;
    private me.tfeng.play.security.oauth2.UserAuthentication user;

    /** Creates a new Builder */
    private Builder() {
      super(me.tfeng.play.security.oauth2.Authentication.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(me.tfeng.play.security.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 (isValidValue(fields()[1], other.user)) {
        this.user = data().deepCopy(fields()[1].schema(), other.user);
        fieldSetFlags()[1] = true;
      }
    }
    
    /** Creates a Builder by copying an existing Authentication instance */
    private Builder(me.tfeng.play.security.oauth2.Authentication other) {
            super(me.tfeng.play.security.oauth2.Authentication.SCHEMA$);
      if (isValidValue(fields()[0], other.client)) {
        this.client = data().deepCopy(fields()[0].schema(), other.client);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.user)) {
        this.user = data().deepCopy(fields()[1].schema(), other.user);
        fieldSetFlags()[1] = true;
      }
    }

    /** Gets the value of the 'client' field */
    public me.tfeng.play.security.oauth2.ClientAuthentication getClient() {
      return client;
    }
    
    /** Sets the value of the 'client' field */
    public me.tfeng.play.security.oauth2.Authentication.Builder setClient(me.tfeng.play.security.oauth2.ClientAuthentication value) {
      validate(fields()[0], value);
      this.client = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'client' field has been set */
    public boolean hasClient() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'client' field */
    public me.tfeng.play.security.oauth2.Authentication.Builder clearClient() {
      client = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'user' field */
    public me.tfeng.play.security.oauth2.UserAuthentication getUser() {
      return user;
    }
    
    /** Sets the value of the 'user' field */
    public me.tfeng.play.security.oauth2.Authentication.Builder setUser(me.tfeng.play.security.oauth2.UserAuthentication value) {
      validate(fields()[1], value);
      this.user = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'user' field has been set */
    public boolean hasUser() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'user' field */
    public me.tfeng.play.security.oauth2.Authentication.Builder clearUser() {
      user = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    @Override
    public Authentication build() {
      try {
        Authentication record = new Authentication();
        record.client = fieldSetFlags()[0] ? this.client : (me.tfeng.play.security.oauth2.ClientAuthentication) defaultValue(fields()[0]);
        record.user = fieldSetFlags()[1] ? this.user : (me.tfeng.play.security.oauth2.UserAuthentication) defaultValue(fields()[1]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy