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

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

/**
 * 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 SplitAmountResponse 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("SplitAmountResponse");

  private static final org.apache.thrift.protocol.TField GROUPED_CURRENCY_AMOUNTS_FIELD_DESC = new org.apache.thrift.protocol.TField("grouped_currency_amounts", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField RESULT_SPLIT_UNIT_FIELD_DESC = new org.apache.thrift.protocol.TField("result_split_unit", org.apache.thrift.protocol.TType.I32, (short)2);

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

  public @org.apache.thrift.annotation.Nullable java.util.List grouped_currency_amounts; // required
  /**
   * 
   * @see SplitUnit
   */
  public @org.apache.thrift.annotation.Nullable SplitUnit result_split_unit; // 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 {
    GROUPED_CURRENCY_AMOUNTS((short)1, "grouped_currency_amounts"),
    /**
     * 
     * @see SplitUnit
     */
    RESULT_SPLIT_UNIT((short)2, "result_split_unit");

    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: // GROUPED_CURRENCY_AMOUNTS
          return GROUPED_CURRENCY_AMOUNTS;
        case 2: // RESULT_SPLIT_UNIT
          return RESULT_SPLIT_UNIT;
        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.GROUPED_CURRENCY_AMOUNTS, new org.apache.thrift.meta_data.FieldMetaData("grouped_currency_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, GroupedCurrencyOffsetAmount.class))));
    tmpMap.put(_Fields.RESULT_SPLIT_UNIT, new org.apache.thrift.meta_data.FieldMetaData("result_split_unit", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SplitUnit.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SplitAmountResponse.class, metaDataMap);
  }

  public SplitAmountResponse() {
  }

  public SplitAmountResponse(
    java.util.List grouped_currency_amounts,
    SplitUnit result_split_unit)
  {
    this();
    this.grouped_currency_amounts = grouped_currency_amounts;
    this.result_split_unit = result_split_unit;
  }

  /**
   * Performs a deep copy on other.
   */
  public SplitAmountResponse(SplitAmountResponse other) {
    if (other.isSetGroupedCurrencyAmounts()) {
      java.util.List __this__grouped_currency_amounts = new java.util.ArrayList(other.grouped_currency_amounts.size());
      for (GroupedCurrencyOffsetAmount other_element : other.grouped_currency_amounts) {
        __this__grouped_currency_amounts.add(new GroupedCurrencyOffsetAmount(other_element));
      }
      this.grouped_currency_amounts = __this__grouped_currency_amounts;
    }
    if (other.isSetResultSplitUnit()) {
      this.result_split_unit = other.result_split_unit;
    }
  }

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

  @Override
  public void clear() {
    this.grouped_currency_amounts = null;
    this.result_split_unit = null;
  }

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

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

  public void addToGroupedCurrencyAmounts(GroupedCurrencyOffsetAmount elem) {
    if (this.grouped_currency_amounts == null) {
      this.grouped_currency_amounts = new java.util.ArrayList();
    }
    this.grouped_currency_amounts.add(elem);
  }

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

  public SplitAmountResponse setGroupedCurrencyAmounts(@org.apache.thrift.annotation.Nullable java.util.List grouped_currency_amounts) {
    this.grouped_currency_amounts = grouped_currency_amounts;
    return this;
  }

  public void unsetGroupedCurrencyAmounts() {
    this.grouped_currency_amounts = null;
  }

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

  public void setGroupedCurrencyAmountsIsSet(boolean value) {
    if (!value) {
      this.grouped_currency_amounts = null;
    }
  }

  /**
   * 
   * @see SplitUnit
   */
  @org.apache.thrift.annotation.Nullable
  public SplitUnit getResultSplitUnit() {
    return this.result_split_unit;
  }

  /**
   * 
   * @see SplitUnit
   */
  public SplitAmountResponse setResultSplitUnit(@org.apache.thrift.annotation.Nullable SplitUnit result_split_unit) {
    this.result_split_unit = result_split_unit;
    return this;
  }

  public void unsetResultSplitUnit() {
    this.result_split_unit = null;
  }

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

  public void setResultSplitUnitIsSet(boolean value) {
    if (!value) {
      this.result_split_unit = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case GROUPED_CURRENCY_AMOUNTS:
      if (value == null) {
        unsetGroupedCurrencyAmounts();
      } else {
        setGroupedCurrencyAmounts((java.util.List)value);
      }
      break;

    case RESULT_SPLIT_UNIT:
      if (value == null) {
        unsetResultSplitUnit();
      } else {
        setResultSplitUnit((SplitUnit)value);
      }
      break;

    }
  }

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

    case RESULT_SPLIT_UNIT:
      return getResultSplitUnit();

    }
    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 GROUPED_CURRENCY_AMOUNTS:
      return isSetGroupedCurrencyAmounts();
    case RESULT_SPLIT_UNIT:
      return isSetResultSplitUnit();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_grouped_currency_amounts = true && this.isSetGroupedCurrencyAmounts();
    boolean that_present_grouped_currency_amounts = true && that.isSetGroupedCurrencyAmounts();
    if (this_present_grouped_currency_amounts || that_present_grouped_currency_amounts) {
      if (!(this_present_grouped_currency_amounts && that_present_grouped_currency_amounts))
        return false;
      if (!this.grouped_currency_amounts.equals(that.grouped_currency_amounts))
        return false;
    }

    boolean this_present_result_split_unit = true && this.isSetResultSplitUnit();
    boolean that_present_result_split_unit = true && that.isSetResultSplitUnit();
    if (this_present_result_split_unit || that_present_result_split_unit) {
      if (!(this_present_result_split_unit && that_present_result_split_unit))
        return false;
      if (!this.result_split_unit.equals(that.result_split_unit))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetGroupedCurrencyAmounts()) ? 131071 : 524287);
    if (isSetGroupedCurrencyAmounts())
      hashCode = hashCode * 8191 + grouped_currency_amounts.hashCode();

    hashCode = hashCode * 8191 + ((isSetResultSplitUnit()) ? 131071 : 524287);
    if (isSetResultSplitUnit())
      hashCode = hashCode * 8191 + result_split_unit.getValue();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetGroupedCurrencyAmounts(), other.isSetGroupedCurrencyAmounts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGroupedCurrencyAmounts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grouped_currency_amounts, other.grouped_currency_amounts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetResultSplitUnit(), other.isSetResultSplitUnit());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResultSplitUnit()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result_split_unit, other.result_split_unit);
      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("SplitAmountResponse(");
    boolean first = true;

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

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (grouped_currency_amounts == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'grouped_currency_amounts' was not present! Struct: " + toString());
    }
    if (result_split_unit == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'result_split_unit' 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 SplitAmountResponseStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public SplitAmountResponseStandardScheme getScheme() {
      return new SplitAmountResponseStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, SplitAmountResponse 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: // GROUPED_CURRENCY_AMOUNTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list64 = iprot.readListBegin();
                struct.grouped_currency_amounts = new java.util.ArrayList(_list64.size);
                @org.apache.thrift.annotation.Nullable GroupedCurrencyOffsetAmount _elem65;
                for (int _i66 = 0; _i66 < _list64.size; ++_i66)
                {
                  _elem65 = new GroupedCurrencyOffsetAmount();
                  _elem65.read(iprot);
                  struct.grouped_currency_amounts.add(_elem65);
                }
                iprot.readListEnd();
              }
              struct.setGroupedCurrencyAmountsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // RESULT_SPLIT_UNIT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.result_split_unit = dev.vality.damsel.analytics.SplitUnit.findByValue(iprot.readI32());
              struct.setResultSplitUnitIsSet(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, SplitAmountResponse struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.grouped_currency_amounts != null) {
        oprot.writeFieldBegin(GROUPED_CURRENCY_AMOUNTS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.grouped_currency_amounts.size()));
          for (GroupedCurrencyOffsetAmount _iter67 : struct.grouped_currency_amounts)
          {
            _iter67.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.result_split_unit != null) {
        oprot.writeFieldBegin(RESULT_SPLIT_UNIT_FIELD_DESC);
        oprot.writeI32(struct.result_split_unit.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SplitAmountResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.grouped_currency_amounts.size());
        for (GroupedCurrencyOffsetAmount _iter68 : struct.grouped_currency_amounts)
        {
          _iter68.write(oprot);
        }
      }
      oprot.writeI32(struct.result_split_unit.getValue());
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SplitAmountResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list69 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.grouped_currency_amounts = new java.util.ArrayList(_list69.size);
        @org.apache.thrift.annotation.Nullable GroupedCurrencyOffsetAmount _elem70;
        for (int _i71 = 0; _i71 < _list69.size; ++_i71)
        {
          _elem70 = new GroupedCurrencyOffsetAmount();
          _elem70.read(iprot);
          struct.grouped_currency_amounts.add(_elem70);
        }
      }
      struct.setGroupedCurrencyAmountsIsSet(true);
      struct.result_split_unit = dev.vality.damsel.analytics.SplitUnit.findByValue(iprot.readI32());
      struct.setResultSplitUnitIsSet(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