Subversion Repositories SmartDukaan

Rev

Rev 8590 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.catalog;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BannerCongregate implements org.apache.thrift.TBase<BannerCongregate, BannerCongregate._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BannerCongregate");

  private static final org.apache.thrift.protocol.TField BANNER_FIELD_DESC = new org.apache.thrift.protocol.TField("banner", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField BANNER_MAPS_FIELD_DESC = new org.apache.thrift.protocol.TField("bannerMaps", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField BANNER_URI_MAPPINGS_FIELD_DESC = new org.apache.thrift.protocol.TField("bannerUriMappings", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField ANTECEDENT_FIELD_DESC = new org.apache.thrift.protocol.TField("antecedent", org.apache.thrift.protocol.TType.STRUCT, (short)4);

  private Banner banner; // required
  private List<BannerMap> bannerMaps; // required
  private List<BannerUriMapping> bannerUriMappings; // required
  private Banner antecedent; // 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 {
    BANNER((short)1, "banner"),
    BANNER_MAPS((short)2, "bannerMaps"),
    BANNER_URI_MAPPINGS((short)3, "bannerUriMappings"),
    ANTECEDENT((short)4, "antecedent");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // BANNER
          return BANNER;
        case 2: // BANNER_MAPS
          return BANNER_MAPS;
        case 3: // BANNER_URI_MAPPINGS
          return BANNER_URI_MAPPINGS;
        case 4: // ANTECEDENT
          return ANTECEDENT;
        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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments

  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.BANNER, new org.apache.thrift.meta_data.FieldMetaData("banner", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Banner.class)));
    tmpMap.put(_Fields.BANNER_MAPS, new org.apache.thrift.meta_data.FieldMetaData("bannerMaps", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        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, BannerMap.class))));
    tmpMap.put(_Fields.BANNER_URI_MAPPINGS, new org.apache.thrift.meta_data.FieldMetaData("bannerUriMappings", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        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, BannerUriMapping.class))));
    tmpMap.put(_Fields.ANTECEDENT, new org.apache.thrift.meta_data.FieldMetaData("antecedent", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Banner.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BannerCongregate.class, metaDataMap);
  }

  public BannerCongregate() {
  }

  public BannerCongregate(
    Banner banner,
    List<BannerMap> bannerMaps,
    List<BannerUriMapping> bannerUriMappings,
    Banner antecedent)
  {
    this();
    this.banner = banner;
    this.bannerMaps = bannerMaps;
    this.bannerUriMappings = bannerUriMappings;
    this.antecedent = antecedent;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public BannerCongregate(BannerCongregate other) {
    if (other.isSetBanner()) {
      this.banner = new Banner(other.banner);
    }
    if (other.isSetBannerMaps()) {
      List<BannerMap> __this__bannerMaps = new ArrayList<BannerMap>();
      for (BannerMap other_element : other.bannerMaps) {
        __this__bannerMaps.add(new BannerMap(other_element));
      }
      this.bannerMaps = __this__bannerMaps;
    }
    if (other.isSetBannerUriMappings()) {
      List<BannerUriMapping> __this__bannerUriMappings = new ArrayList<BannerUriMapping>();
      for (BannerUriMapping other_element : other.bannerUriMappings) {
        __this__bannerUriMappings.add(new BannerUriMapping(other_element));
      }
      this.bannerUriMappings = __this__bannerUriMappings;
    }
    if (other.isSetAntecedent()) {
      this.antecedent = new Banner(other.antecedent);
    }
  }

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

  @Override
  public void clear() {
    this.banner = null;
    this.bannerMaps = null;
    this.bannerUriMappings = null;
    this.antecedent = null;
  }

  public Banner getBanner() {
    return this.banner;
  }

  public void setBanner(Banner banner) {
    this.banner = banner;
  }

  public void unsetBanner() {
    this.banner = null;
  }

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

  public void setBannerIsSet(boolean value) {
    if (!value) {
      this.banner = null;
    }
  }

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

  public java.util.Iterator<BannerMap> getBannerMapsIterator() {
    return (this.bannerMaps == null) ? null : this.bannerMaps.iterator();
  }

  public void addToBannerMaps(BannerMap elem) {
    if (this.bannerMaps == null) {
      this.bannerMaps = new ArrayList<BannerMap>();
    }
    this.bannerMaps.add(elem);
  }

  public List<BannerMap> getBannerMaps() {
    return this.bannerMaps;
  }

  public void setBannerMaps(List<BannerMap> bannerMaps) {
    this.bannerMaps = bannerMaps;
  }

  public void unsetBannerMaps() {
    this.bannerMaps = null;
  }

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

  public void setBannerMapsIsSet(boolean value) {
    if (!value) {
      this.bannerMaps = null;
    }
  }

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

  public java.util.Iterator<BannerUriMapping> getBannerUriMappingsIterator() {
    return (this.bannerUriMappings == null) ? null : this.bannerUriMappings.iterator();
  }

  public void addToBannerUriMappings(BannerUriMapping elem) {
    if (this.bannerUriMappings == null) {
      this.bannerUriMappings = new ArrayList<BannerUriMapping>();
    }
    this.bannerUriMappings.add(elem);
  }

  public List<BannerUriMapping> getBannerUriMappings() {
    return this.bannerUriMappings;
  }

  public void setBannerUriMappings(List<BannerUriMapping> bannerUriMappings) {
    this.bannerUriMappings = bannerUriMappings;
  }

  public void unsetBannerUriMappings() {
    this.bannerUriMappings = null;
  }

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

  public void setBannerUriMappingsIsSet(boolean value) {
    if (!value) {
      this.bannerUriMappings = null;
    }
  }

  public Banner getAntecedent() {
    return this.antecedent;
  }

  public void setAntecedent(Banner antecedent) {
    this.antecedent = antecedent;
  }

  public void unsetAntecedent() {
    this.antecedent = null;
  }

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

  public void setAntecedentIsSet(boolean value) {
    if (!value) {
      this.antecedent = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case BANNER:
      if (value == null) {
        unsetBanner();
      } else {
        setBanner((Banner)value);
      }
      break;

    case BANNER_MAPS:
      if (value == null) {
        unsetBannerMaps();
      } else {
        setBannerMaps((List<BannerMap>)value);
      }
      break;

    case BANNER_URI_MAPPINGS:
      if (value == null) {
        unsetBannerUriMappings();
      } else {
        setBannerUriMappings((List<BannerUriMapping>)value);
      }
      break;

    case ANTECEDENT:
      if (value == null) {
        unsetAntecedent();
      } else {
        setAntecedent((Banner)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case BANNER:
      return getBanner();

    case BANNER_MAPS:
      return getBannerMaps();

    case BANNER_URI_MAPPINGS:
      return getBannerUriMappings();

    case ANTECEDENT:
      return getAntecedent();

    }
    throw new 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 IllegalArgumentException();
    }

    switch (field) {
    case BANNER:
      return isSetBanner();
    case BANNER_MAPS:
      return isSetBannerMaps();
    case BANNER_URI_MAPPINGS:
      return isSetBannerUriMappings();
    case ANTECEDENT:
      return isSetAntecedent();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof BannerCongregate)
      return this.equals((BannerCongregate)that);
    return false;
  }

  public boolean equals(BannerCongregate that) {
    if (that == null)
      return false;

    boolean this_present_banner = true && this.isSetBanner();
    boolean that_present_banner = true && that.isSetBanner();
    if (this_present_banner || that_present_banner) {
      if (!(this_present_banner && that_present_banner))
        return false;
      if (!this.banner.equals(that.banner))
        return false;
    }

    boolean this_present_bannerMaps = true && this.isSetBannerMaps();
    boolean that_present_bannerMaps = true && that.isSetBannerMaps();
    if (this_present_bannerMaps || that_present_bannerMaps) {
      if (!(this_present_bannerMaps && that_present_bannerMaps))
        return false;
      if (!this.bannerMaps.equals(that.bannerMaps))
        return false;
    }

    boolean this_present_bannerUriMappings = true && this.isSetBannerUriMappings();
    boolean that_present_bannerUriMappings = true && that.isSetBannerUriMappings();
    if (this_present_bannerUriMappings || that_present_bannerUriMappings) {
      if (!(this_present_bannerUriMappings && that_present_bannerUriMappings))
        return false;
      if (!this.bannerUriMappings.equals(that.bannerUriMappings))
        return false;
    }

    boolean this_present_antecedent = true && this.isSetAntecedent();
    boolean that_present_antecedent = true && that.isSetAntecedent();
    if (this_present_antecedent || that_present_antecedent) {
      if (!(this_present_antecedent && that_present_antecedent))
        return false;
      if (!this.antecedent.equals(that.antecedent))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

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

    int lastComparison = 0;
    BannerCongregate typedOther = (BannerCongregate)other;

    lastComparison = Boolean.valueOf(isSetBanner()).compareTo(typedOther.isSetBanner());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBanner()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.banner, typedOther.banner);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBannerMaps()).compareTo(typedOther.isSetBannerMaps());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBannerMaps()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bannerMaps, typedOther.bannerMaps);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBannerUriMappings()).compareTo(typedOther.isSetBannerUriMappings());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBannerUriMappings()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bannerUriMappings, typedOther.bannerUriMappings);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAntecedent()).compareTo(typedOther.isSetAntecedent());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAntecedent()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.antecedent, typedOther.antecedent);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // BANNER
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.banner = new Banner();
            this.banner.read(iprot);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // BANNER_MAPS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list9 = iprot.readListBegin();
              this.bannerMaps = new ArrayList<BannerMap>(_list9.size);
              for (int _i10 = 0; _i10 < _list9.size; ++_i10)
              {
                BannerMap _elem11; // required
                _elem11 = new BannerMap();
                _elem11.read(iprot);
                this.bannerMaps.add(_elem11);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // BANNER_URI_MAPPINGS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list12 = iprot.readListBegin();
              this.bannerUriMappings = new ArrayList<BannerUriMapping>(_list12.size);
              for (int _i13 = 0; _i13 < _list12.size; ++_i13)
              {
                BannerUriMapping _elem14; // required
                _elem14 = new BannerUriMapping();
                _elem14.read(iprot);
                this.bannerUriMappings.add(_elem14);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // ANTECEDENT
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.antecedent = new Banner();
            this.antecedent.read(iprot);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.banner != null) {
      oprot.writeFieldBegin(BANNER_FIELD_DESC);
      this.banner.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.bannerMaps != null) {
      oprot.writeFieldBegin(BANNER_MAPS_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.bannerMaps.size()));
        for (BannerMap _iter15 : this.bannerMaps)
        {
          _iter15.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.bannerUriMappings != null) {
      oprot.writeFieldBegin(BANNER_URI_MAPPINGS_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.bannerUriMappings.size()));
        for (BannerUriMapping _iter16 : this.bannerUriMappings)
        {
          _iter16.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.antecedent != null) {
      oprot.writeFieldBegin(ANTECEDENT_FIELD_DESC);
      this.antecedent.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("BannerCongregate(");
    boolean first = true;

    sb.append("banner:");
    if (this.banner == null) {
      sb.append("null");
    } else {
      sb.append(this.banner);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("bannerMaps:");
    if (this.bannerMaps == null) {
      sb.append("null");
    } else {
      sb.append(this.bannerMaps);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("bannerUriMappings:");
    if (this.bannerUriMappings == null) {
      sb.append("null");
    } else {
      sb.append(this.bannerUriMappings);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("antecedent:");
    if (this.antecedent == null) {
      sb.append("null");
    } else {
      sb.append(this.antecedent);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  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, 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);
    }
  }

}