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

dev.vality.damsel.dominant.cache.Country 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.dominant.cache;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.2)", date = "2024-05-28")
public class Country 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("Country");

  private static final org.apache.thrift.protocol.TField REF_FIELD_DESC = new org.apache.thrift.protocol.TField("ref", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField TRADE_BLOCS_FIELD_DESC = new org.apache.thrift.protocol.TField("trade_blocs", org.apache.thrift.protocol.TType.SET, (short)3);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String ref; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String name; // required
  public @org.apache.thrift.annotation.Nullable java.util.Set trade_blocs; // 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 {
    REF((short)1, "ref"),
    NAME((short)2, "name"),
    TRADE_BLOCS((short)3, "trade_blocs");

    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: // REF
          return REF;
        case 2: // NAME
          return NAME;
        case 3: // TRADE_BLOCS
          return TRADE_BLOCS;
        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.REF, new org.apache.thrift.meta_data.FieldMetaData("ref", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TRADE_BLOCS, new org.apache.thrift.meta_data.FieldMetaData("trade_blocs", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Country.class, metaDataMap);
  }

  public Country() {
  }

  public Country(
    java.lang.String ref,
    java.lang.String name,
    java.util.Set trade_blocs)
  {
    this();
    this.ref = ref;
    this.name = name;
    this.trade_blocs = trade_blocs;
  }

  /**
   * Performs a deep copy on other.
   */
  public Country(Country other) {
    if (other.isSetRef()) {
      this.ref = other.ref;
    }
    if (other.isSetName()) {
      this.name = other.name;
    }
    if (other.isSetTradeBlocs()) {
      java.util.Set __this__trade_blocs = new java.util.HashSet(other.trade_blocs.size());
      for (java.lang.String other_element : other.trade_blocs) {
        __this__trade_blocs.add(other_element);
      }
      this.trade_blocs = __this__trade_blocs;
    }
  }

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

  @Override
  public void clear() {
    this.ref = null;
    this.name = null;
    this.trade_blocs = null;
  }

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

  public Country setRef(@org.apache.thrift.annotation.Nullable java.lang.String ref) {
    this.ref = ref;
    return this;
  }

  public void unsetRef() {
    this.ref = null;
  }

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

  public void setRefIsSet(boolean value) {
    if (!value) {
      this.ref = null;
    }
  }

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

  public Country setName(@org.apache.thrift.annotation.Nullable java.lang.String name) {
    this.name = name;
    return this;
  }

  public void unsetName() {
    this.name = null;
  }

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

  public void setNameIsSet(boolean value) {
    if (!value) {
      this.name = null;
    }
  }

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

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

  public void addToTradeBlocs(java.lang.String elem) {
    if (this.trade_blocs == null) {
      this.trade_blocs = new java.util.HashSet();
    }
    this.trade_blocs.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Set getTradeBlocs() {
    return this.trade_blocs;
  }

  public Country setTradeBlocs(@org.apache.thrift.annotation.Nullable java.util.Set trade_blocs) {
    this.trade_blocs = trade_blocs;
    return this;
  }

  public void unsetTradeBlocs() {
    this.trade_blocs = null;
  }

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

  public void setTradeBlocsIsSet(boolean value) {
    if (!value) {
      this.trade_blocs = null;
    }
  }

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

    case NAME:
      if (value == null) {
        unsetName();
      } else {
        setName((java.lang.String)value);
      }
      break;

    case TRADE_BLOCS:
      if (value == null) {
        unsetTradeBlocs();
      } else {
        setTradeBlocs((java.util.Set)value);
      }
      break;

    }
  }

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

    case NAME:
      return getName();

    case TRADE_BLOCS:
      return getTradeBlocs();

    }
    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 REF:
      return isSetRef();
    case NAME:
      return isSetName();
    case TRADE_BLOCS:
      return isSetTradeBlocs();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_ref = true && this.isSetRef();
    boolean that_present_ref = true && that.isSetRef();
    if (this_present_ref || that_present_ref) {
      if (!(this_present_ref && that_present_ref))
        return false;
      if (!this.ref.equals(that.ref))
        return false;
    }

    boolean this_present_name = true && this.isSetName();
    boolean that_present_name = true && that.isSetName();
    if (this_present_name || that_present_name) {
      if (!(this_present_name && that_present_name))
        return false;
      if (!this.name.equals(that.name))
        return false;
    }

    boolean this_present_trade_blocs = true && this.isSetTradeBlocs();
    boolean that_present_trade_blocs = true && that.isSetTradeBlocs();
    if (this_present_trade_blocs || that_present_trade_blocs) {
      if (!(this_present_trade_blocs && that_present_trade_blocs))
        return false;
      if (!this.trade_blocs.equals(that.trade_blocs))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetRef()) ? 131071 : 524287);
    if (isSetRef())
      hashCode = hashCode * 8191 + ref.hashCode();

    hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287);
    if (isSetName())
      hashCode = hashCode * 8191 + name.hashCode();

    hashCode = hashCode * 8191 + ((isSetTradeBlocs()) ? 131071 : 524287);
    if (isSetTradeBlocs())
      hashCode = hashCode * 8191 + trade_blocs.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetRef(), other.isSetRef());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRef()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ref, other.ref);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTradeBlocs(), other.isSetTradeBlocs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTradeBlocs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.trade_blocs, other.trade_blocs);
      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("Country(");
    boolean first = true;

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

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

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, Country 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: // REF
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.ref = iprot.readString();
              struct.setRefIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.name = iprot.readString();
              struct.setNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TRADE_BLOCS
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set18 = iprot.readSetBegin();
                struct.trade_blocs = new java.util.HashSet(2*_set18.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _elem19;
                for (int _i20 = 0; _i20 < _set18.size; ++_i20)
                {
                  _elem19 = iprot.readString();
                  struct.trade_blocs.add(_elem19);
                }
                iprot.readSetEnd();
              }
              struct.setTradeBlocsIsSet(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, Country struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.ref != null) {
        oprot.writeFieldBegin(REF_FIELD_DESC);
        oprot.writeString(struct.ref);
        oprot.writeFieldEnd();
      }
      if (struct.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeString(struct.name);
        oprot.writeFieldEnd();
      }
      if (struct.trade_blocs != null) {
        oprot.writeFieldBegin(TRADE_BLOCS_FIELD_DESC);
        {
          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.trade_blocs.size()));
          for (java.lang.String _iter21 : struct.trade_blocs)
          {
            oprot.writeString(_iter21);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Country struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.ref);
      oprot.writeString(struct.name);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetTradeBlocs()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetTradeBlocs()) {
        {
          oprot.writeI32(struct.trade_blocs.size());
          for (java.lang.String _iter22 : struct.trade_blocs)
          {
            oprot.writeString(_iter22);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Country struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.ref = iprot.readString();
      struct.setRefIsSet(true);
      struct.name = iprot.readString();
      struct.setNameIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TSet _set23 = iprot.readSetBegin(org.apache.thrift.protocol.TType.STRING);
          struct.trade_blocs = new java.util.HashSet(2*_set23.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _elem24;
          for (int _i25 = 0; _i25 < _set23.size; ++_i25)
          {
            _elem24 = iprot.readString();
            struct.trade_blocs.add(_elem24);
          }
        }
        struct.setTradeBlocsIsSet(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 - 2024 Weber Informatics LLC | Privacy Policy