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

dev.vality.damsel.analytics.GroupedCurrencyOffsetAmount Maven / Gradle / Ivy

Go to download

Generates jar artifact containing compiled thrift classes based on generated thrift IDL files

There is a newer version: 1.43-2d1fdc2
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.14.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package dev.vality.damsel.analytics;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
/**
 * Результат оборотов сгруппированных по валюте
 * 
 */
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.2)", date = "2022-11-14")
public class GroupedCurrencyOffsetAmount implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GroupedCurrencyOffsetAmount");

  private static final org.apache.thrift.protocol.TField CURRENCY_FIELD_DESC = new org.apache.thrift.protocol.TField("currency", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField OFFSET_AMOUNTS_FIELD_DESC = new org.apache.thrift.protocol.TField("offset_amounts", org.apache.thrift.protocol.TType.LIST, (short)2);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new GroupedCurrencyOffsetAmountStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new GroupedCurrencyOffsetAmountTupleSchemeFactory();

  public @org.apache.thrift.annotation.Nullable java.lang.String currency; // required
  public @org.apache.thrift.annotation.Nullable java.util.List offset_amounts; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    CURRENCY((short)1, "currency"),
    OFFSET_AMOUNTS((short)2, "offset_amounts");

    private static final java.util.Map byName = new java.util.HashMap();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // CURRENCY
          return CURRENCY;
        case 2: // OFFSET_AMOUNTS
          return OFFSET_AMOUNTS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.CURRENCY, new org.apache.thrift.meta_data.FieldMetaData("currency", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.OFFSET_AMOUNTS, new org.apache.thrift.meta_data.FieldMetaData("offset_amounts", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, OffsetAmount.class))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GroupedCurrencyOffsetAmount.class, metaDataMap);
  }

  public GroupedCurrencyOffsetAmount() {
  }

  public GroupedCurrencyOffsetAmount(
    java.lang.String currency,
    java.util.List offset_amounts)
  {
    this();
    this.currency = currency;
    this.offset_amounts = offset_amounts;
  }

  /**
   * Performs a deep copy on other.
   */
  public GroupedCurrencyOffsetAmount(GroupedCurrencyOffsetAmount other) {
    if (other.isSetCurrency()) {
      this.currency = other.currency;
    }
    if (other.isSetOffsetAmounts()) {
      java.util.List __this__offset_amounts = new java.util.ArrayList(other.offset_amounts.size());
      for (OffsetAmount other_element : other.offset_amounts) {
        __this__offset_amounts.add(new OffsetAmount(other_element));
      }
      this.offset_amounts = __this__offset_amounts;
    }
  }

  public GroupedCurrencyOffsetAmount deepCopy() {
    return new GroupedCurrencyOffsetAmount(this);
  }

  @Override
  public void clear() {
    this.currency = null;
    this.offset_amounts = null;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getCurrency() {
    return this.currency;
  }

  public GroupedCurrencyOffsetAmount setCurrency(@org.apache.thrift.annotation.Nullable java.lang.String currency) {
    this.currency = currency;
    return this;
  }

  public void unsetCurrency() {
    this.currency = null;
  }

  /** Returns true if field currency is set (has been assigned a value) and false otherwise */
  public boolean isSetCurrency() {
    return this.currency != null;
  }

  public void setCurrencyIsSet(boolean value) {
    if (!value) {
      this.currency = null;
    }
  }

  public int getOffsetAmountsSize() {
    return (this.offset_amounts == null) ? 0 : this.offset_amounts.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator getOffsetAmountsIterator() {
    return (this.offset_amounts == null) ? null : this.offset_amounts.iterator();
  }

  public void addToOffsetAmounts(OffsetAmount elem) {
    if (this.offset_amounts == null) {
      this.offset_amounts = new java.util.ArrayList();
    }
    this.offset_amounts.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List getOffsetAmounts() {
    return this.offset_amounts;
  }

  public GroupedCurrencyOffsetAmount setOffsetAmounts(@org.apache.thrift.annotation.Nullable java.util.List offset_amounts) {
    this.offset_amounts = offset_amounts;
    return this;
  }

  public void unsetOffsetAmounts() {
    this.offset_amounts = null;
  }

  /** Returns true if field offset_amounts is set (has been assigned a value) and false otherwise */
  public boolean isSetOffsetAmounts() {
    return this.offset_amounts != null;
  }

  public void setOffsetAmountsIsSet(boolean value) {
    if (!value) {
      this.offset_amounts = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case CURRENCY:
      if (value == null) {
        unsetCurrency();
      } else {
        setCurrency((java.lang.String)value);
      }
      break;

    case OFFSET_AMOUNTS:
      if (value == null) {
        unsetOffsetAmounts();
      } else {
        setOffsetAmounts((java.util.List)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case CURRENCY:
      return getCurrency();

    case OFFSET_AMOUNTS:
      return getOffsetAmounts();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case CURRENCY:
      return isSetCurrency();
    case OFFSET_AMOUNTS:
      return isSetOffsetAmounts();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof GroupedCurrencyOffsetAmount)
      return this.equals((GroupedCurrencyOffsetAmount)that);
    return false;
  }

  public boolean equals(GroupedCurrencyOffsetAmount that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_currency = true && this.isSetCurrency();
    boolean that_present_currency = true && that.isSetCurrency();
    if (this_present_currency || that_present_currency) {
      if (!(this_present_currency && that_present_currency))
        return false;
      if (!this.currency.equals(that.currency))
        return false;
    }

    boolean this_present_offset_amounts = true && this.isSetOffsetAmounts();
    boolean that_present_offset_amounts = true && that.isSetOffsetAmounts();
    if (this_present_offset_amounts || that_present_offset_amounts) {
      if (!(this_present_offset_amounts && that_present_offset_amounts))
        return false;
      if (!this.offset_amounts.equals(that.offset_amounts))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetCurrency()) ? 131071 : 524287);
    if (isSetCurrency())
      hashCode = hashCode * 8191 + currency.hashCode();

    hashCode = hashCode * 8191 + ((isSetOffsetAmounts()) ? 131071 : 524287);
    if (isSetOffsetAmounts())
      hashCode = hashCode * 8191 + offset_amounts.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(GroupedCurrencyOffsetAmount other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetCurrency(), other.isSetCurrency());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCurrency()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.currency, other.currency);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetOffsetAmounts(), other.isSetOffsetAmounts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOffsetAmounts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.offset_amounts, other.offset_amounts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public _Fields[] getFields() {
    return _Fields.values();
  }

  public java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
    return metaDataMap;
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("GroupedCurrencyOffsetAmount(");
    boolean first = true;

    sb.append("currency:");
    if (this.currency == null) {
      sb.append("null");
    } else {
      sb.append(this.currency);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("offset_amounts:");
    if (this.offset_amounts == null) {
      sb.append("null");
    } else {
      sb.append(this.offset_amounts);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (currency == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'currency' was not present! Struct: " + toString());
    }
    if (offset_amounts == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'offset_amounts' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class GroupedCurrencyOffsetAmountStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public GroupedCurrencyOffsetAmountStandardScheme getScheme() {
      return new GroupedCurrencyOffsetAmountStandardScheme();
    }
  }

  private static class GroupedCurrencyOffsetAmountStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, GroupedCurrencyOffsetAmount struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // CURRENCY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.currency = iprot.readString();
              struct.setCurrencyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // OFFSET_AMOUNTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list72 = iprot.readListBegin();
                struct.offset_amounts = new java.util.ArrayList(_list72.size);
                @org.apache.thrift.annotation.Nullable OffsetAmount _elem73;
                for (int _i74 = 0; _i74 < _list72.size; ++_i74)
                {
                  _elem73 = new OffsetAmount();
                  _elem73.read(iprot);
                  struct.offset_amounts.add(_elem73);
                }
                iprot.readListEnd();
              }
              struct.setOffsetAmountsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, GroupedCurrencyOffsetAmount struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.currency != null) {
        oprot.writeFieldBegin(CURRENCY_FIELD_DESC);
        oprot.writeString(struct.currency);
        oprot.writeFieldEnd();
      }
      if (struct.offset_amounts != null) {
        oprot.writeFieldBegin(OFFSET_AMOUNTS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.offset_amounts.size()));
          for (OffsetAmount _iter75 : struct.offset_amounts)
          {
            _iter75.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class GroupedCurrencyOffsetAmountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public GroupedCurrencyOffsetAmountTupleScheme getScheme() {
      return new GroupedCurrencyOffsetAmountTupleScheme();
    }
  }

  private static class GroupedCurrencyOffsetAmountTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, GroupedCurrencyOffsetAmount struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.currency);
      {
        oprot.writeI32(struct.offset_amounts.size());
        for (OffsetAmount _iter76 : struct.offset_amounts)
        {
          _iter76.write(oprot);
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, GroupedCurrencyOffsetAmount struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.currency = iprot.readString();
      struct.setCurrencyIsSet(true);
      {
        org.apache.thrift.protocol.TList _list77 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.offset_amounts = new java.util.ArrayList(_list77.size);
        @org.apache.thrift.annotation.Nullable OffsetAmount _elem78;
        for (int _i79 = 0; _i79 < _list77.size; ++_i79)
        {
          _elem78 = new OffsetAmount();
          _elem78.read(iprot);
          struct.offset_amounts.add(_elem78);
        }
      }
      struct.setOffsetAmountsIsSet(true);
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy