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

com.datawizards.model.UserAction Maven / Gradle / Ivy

There is a newer version: 0.1.3
Show newest version
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package com.datawizards.model;

import org.apache.avro.specific.SpecificData;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;

@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class UserAction extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = -4172271343800509450L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"UserAction\",\"namespace\":\"com.datawizards.model\",\"fields\":[{\"name\":\"event_id\",\"type\":\"string\"},{\"name\":\"session_id\",\"type\":\"string\"},{\"name\":\"event_type\",\"type\":\"string\"},{\"name\":\"event_date\",\"type\":{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}},{\"name\":\"user_id\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"listing_id\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"device\",\"type\":[\"null\",\"string\"],\"default\":null}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static SpecificData MODEL$ = new SpecificData();

  private static final BinaryMessageEncoder ENCODER =
      new BinaryMessageEncoder(MODEL$, SCHEMA$);

  private static final BinaryMessageDecoder DECODER =
      new BinaryMessageDecoder(MODEL$, SCHEMA$);

  /**
   * Return the BinaryMessageDecoder instance 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
   */
  public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
    return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
  }

  /** Serializes this UserAction to a ByteBuffer. */
  public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
    return ENCODER.encode(this);
  }

  /** Deserializes a UserAction from a ByteBuffer. */
  public static UserAction fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

  @Deprecated public java.lang.CharSequence event_id;
  @Deprecated public java.lang.CharSequence session_id;
  @Deprecated public java.lang.CharSequence event_type;
  @Deprecated public org.joda.time.DateTime event_date;
  @Deprecated public java.lang.CharSequence user_id;
  @Deprecated public java.lang.CharSequence listing_id;
  @Deprecated public java.lang.CharSequence device;

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

  /**
   * All-args constructor.
   * @param event_id The new value for event_id
   * @param session_id The new value for session_id
   * @param event_type The new value for event_type
   * @param event_date The new value for event_date
   * @param user_id The new value for user_id
   * @param listing_id The new value for listing_id
   * @param device The new value for device
   */
  public UserAction(java.lang.CharSequence event_id, java.lang.CharSequence session_id, java.lang.CharSequence event_type, org.joda.time.DateTime event_date, java.lang.CharSequence user_id, java.lang.CharSequence listing_id, java.lang.CharSequence device) {
    this.event_id = event_id;
    this.session_id = session_id;
    this.event_type = event_type;
    this.event_date = event_date;
    this.user_id = user_id;
    this.listing_id = listing_id;
    this.device = device;
  }

  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 event_id;
    case 1: return session_id;
    case 2: return event_type;
    case 3: return event_date;
    case 4: return user_id;
    case 5: return listing_id;
    case 6: return device;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  protected static final org.apache.avro.data.TimeConversions.DateConversion DATE_CONVERSION = new org.apache.avro.data.TimeConversions.DateConversion();
  protected static final org.apache.avro.data.TimeConversions.TimeConversion TIME_CONVERSION = new org.apache.avro.data.TimeConversions.TimeConversion();
  protected static final org.apache.avro.data.TimeConversions.TimestampConversion TIMESTAMP_CONVERSION = new org.apache.avro.data.TimeConversions.TimestampConversion();
  protected static final org.apache.avro.Conversions.DecimalConversion DECIMAL_CONVERSION = new org.apache.avro.Conversions.DecimalConversion();

  private static final org.apache.avro.Conversion[] conversions =
      new org.apache.avro.Conversion[] {
      null,
      null,
      null,
      TIMESTAMP_CONVERSION,
      null,
      null,
      null,
      null
  };

  @Override
  public org.apache.avro.Conversion getConversion(int field) {
    return conversions[field];
  }

  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: event_id = (java.lang.CharSequence)value$; break;
    case 1: session_id = (java.lang.CharSequence)value$; break;
    case 2: event_type = (java.lang.CharSequence)value$; break;
    case 3: event_date = (org.joda.time.DateTime)value$; break;
    case 4: user_id = (java.lang.CharSequence)value$; break;
    case 5: listing_id = (java.lang.CharSequence)value$; break;
    case 6: device = (java.lang.CharSequence)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'event_id' field.
   * @return The value of the 'event_id' field.
   */
  public java.lang.CharSequence getEventId() {
    return event_id;
  }

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

  /**
   * Gets the value of the 'session_id' field.
   * @return The value of the 'session_id' field.
   */
  public java.lang.CharSequence getSessionId() {
    return session_id;
  }

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

  /**
   * Gets the value of the 'event_type' field.
   * @return The value of the 'event_type' field.
   */
  public java.lang.CharSequence getEventType() {
    return event_type;
  }

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

  /**
   * Gets the value of the 'event_date' field.
   * @return The value of the 'event_date' field.
   */
  public org.joda.time.DateTime getEventDate() {
    return event_date;
  }

  /**
   * Sets the value of the 'event_date' field.
   * @param value the value to set.
   */
  public void setEventDate(org.joda.time.DateTime value) {
    this.event_date = value;
  }

  /**
   * Gets the value of the 'user_id' field.
   * @return The value of the 'user_id' field.
   */
  public java.lang.CharSequence getUserId() {
    return user_id;
  }

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

  /**
   * Gets the value of the 'listing_id' field.
   * @return The value of the 'listing_id' field.
   */
  public java.lang.CharSequence getListingId() {
    return listing_id;
  }

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

  /**
   * Gets the value of the 'device' field.
   * @return The value of the 'device' field.
   */
  public java.lang.CharSequence getDevice() {
    return device;
  }

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

  /**
   * Creates a new UserAction RecordBuilder.
   * @return A new UserAction RecordBuilder
   */
  public static com.datawizards.model.UserAction.Builder newBuilder() {
    return new com.datawizards.model.UserAction.Builder();
  }

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

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

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

    private java.lang.CharSequence event_id;
    private java.lang.CharSequence session_id;
    private java.lang.CharSequence event_type;
    private org.joda.time.DateTime event_date;
    private java.lang.CharSequence user_id;
    private java.lang.CharSequence listing_id;
    private java.lang.CharSequence device;

    /** 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(com.datawizards.model.UserAction.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.event_id)) {
        this.event_id = data().deepCopy(fields()[0].schema(), other.event_id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.session_id)) {
        this.session_id = data().deepCopy(fields()[1].schema(), other.session_id);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.event_type)) {
        this.event_type = data().deepCopy(fields()[2].schema(), other.event_type);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.event_date)) {
        this.event_date = data().deepCopy(fields()[3].schema(), other.event_date);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.user_id)) {
        this.user_id = data().deepCopy(fields()[4].schema(), other.user_id);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.listing_id)) {
        this.listing_id = data().deepCopy(fields()[5].schema(), other.listing_id);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.device)) {
        this.device = data().deepCopy(fields()[6].schema(), other.device);
        fieldSetFlags()[6] = true;
      }
    }

    /**
     * Creates a Builder by copying an existing UserAction instance
     * @param other The existing instance to copy.
     */
    private Builder(com.datawizards.model.UserAction other) {
            super(SCHEMA$);
      if (isValidValue(fields()[0], other.event_id)) {
        this.event_id = data().deepCopy(fields()[0].schema(), other.event_id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.session_id)) {
        this.session_id = data().deepCopy(fields()[1].schema(), other.session_id);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.event_type)) {
        this.event_type = data().deepCopy(fields()[2].schema(), other.event_type);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.event_date)) {
        this.event_date = data().deepCopy(fields()[3].schema(), other.event_date);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.user_id)) {
        this.user_id = data().deepCopy(fields()[4].schema(), other.user_id);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.listing_id)) {
        this.listing_id = data().deepCopy(fields()[5].schema(), other.listing_id);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.device)) {
        this.device = data().deepCopy(fields()[6].schema(), other.device);
        fieldSetFlags()[6] = true;
      }
    }

    /**
      * Gets the value of the 'event_id' field.
      * @return The value.
      */
    public java.lang.CharSequence getEventId() {
      return event_id;
    }

    /**
      * Sets the value of the 'event_id' field.
      * @param value The value of 'event_id'.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder setEventId(java.lang.CharSequence value) {
      validate(fields()[0], value);
      this.event_id = value;
      fieldSetFlags()[0] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'event_id' field.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder clearEventId() {
      event_id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'session_id' field.
      * @return The value.
      */
    public java.lang.CharSequence getSessionId() {
      return session_id;
    }

    /**
      * Sets the value of the 'session_id' field.
      * @param value The value of 'session_id'.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder setSessionId(java.lang.CharSequence value) {
      validate(fields()[1], value);
      this.session_id = value;
      fieldSetFlags()[1] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'session_id' field.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder clearSessionId() {
      session_id = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /**
      * Gets the value of the 'event_type' field.
      * @return The value.
      */
    public java.lang.CharSequence getEventType() {
      return event_type;
    }

    /**
      * Sets the value of the 'event_type' field.
      * @param value The value of 'event_type'.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder setEventType(java.lang.CharSequence value) {
      validate(fields()[2], value);
      this.event_type = value;
      fieldSetFlags()[2] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'event_type' field.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder clearEventType() {
      event_type = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'event_date' field.
      * @return The value.
      */
    public org.joda.time.DateTime getEventDate() {
      return event_date;
    }

    /**
      * Sets the value of the 'event_date' field.
      * @param value The value of 'event_date'.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder setEventDate(org.joda.time.DateTime value) {
      validate(fields()[3], value);
      this.event_date = value;
      fieldSetFlags()[3] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'event_date' field.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder clearEventDate() {
      fieldSetFlags()[3] = false;
      return this;
    }

    /**
      * Gets the value of the 'user_id' field.
      * @return The value.
      */
    public java.lang.CharSequence getUserId() {
      return user_id;
    }

    /**
      * Sets the value of the 'user_id' field.
      * @param value The value of 'user_id'.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder setUserId(java.lang.CharSequence value) {
      validate(fields()[4], value);
      this.user_id = value;
      fieldSetFlags()[4] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'user_id' field.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder clearUserId() {
      user_id = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /**
      * Gets the value of the 'listing_id' field.
      * @return The value.
      */
    public java.lang.CharSequence getListingId() {
      return listing_id;
    }

    /**
      * Sets the value of the 'listing_id' field.
      * @param value The value of 'listing_id'.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder setListingId(java.lang.CharSequence value) {
      validate(fields()[5], value);
      this.listing_id = value;
      fieldSetFlags()[5] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'listing_id' field.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder clearListingId() {
      listing_id = null;
      fieldSetFlags()[5] = false;
      return this;
    }

    /**
      * Gets the value of the 'device' field.
      * @return The value.
      */
    public java.lang.CharSequence getDevice() {
      return device;
    }

    /**
      * Sets the value of the 'device' field.
      * @param value The value of 'device'.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder setDevice(java.lang.CharSequence value) {
      validate(fields()[6], value);
      this.device = value;
      fieldSetFlags()[6] = true;
      return this;
    }

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


    /**
      * Clears the value of the 'device' field.
      * @return This builder.
      */
    public com.datawizards.model.UserAction.Builder clearDevice() {
      device = null;
      fieldSetFlags()[6] = false;
      return this;
    }

    @Override
    @SuppressWarnings("unchecked")
    public UserAction build() {
      try {
        UserAction record = new UserAction();
        record.event_id = fieldSetFlags()[0] ? this.event_id : (java.lang.CharSequence) defaultValue(fields()[0], record.getConversion(0));
        record.session_id = fieldSetFlags()[1] ? this.session_id : (java.lang.CharSequence) defaultValue(fields()[1], record.getConversion(1));
        record.event_type = fieldSetFlags()[2] ? this.event_type : (java.lang.CharSequence) defaultValue(fields()[2], record.getConversion(2));
        record.event_date = fieldSetFlags()[3] ? this.event_date : (org.joda.time.DateTime) defaultValue(fields()[3], record.getConversion(3));
        record.user_id = fieldSetFlags()[4] ? this.user_id : (java.lang.CharSequence) defaultValue(fields()[4], record.getConversion(4));
        record.listing_id = fieldSetFlags()[5] ? this.listing_id : (java.lang.CharSequence) defaultValue(fields()[5], record.getConversion(5));
        record.device = fieldSetFlags()[6] ? this.device : (java.lang.CharSequence) defaultValue(fields()[6], record.getConversion(6));
        return record;
      } 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