Subversion Repositories SmartDukaan

Rev

Rev 1013 | Blame | 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.user;

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;

/**
 * All the social handles
 */
public class SocialHandles implements org.apache.thrift.TBase<SocialHandles, SocialHandles._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SocialHandles");

  private static final org.apache.thrift.protocol.TField FACEBOOK_FIELD_DESC = new org.apache.thrift.protocol.TField("facebook", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField OPENSOCIAL_FIELD_DESC = new org.apache.thrift.protocol.TField("opensocial", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField TWITTER_FIELD_DESC = new org.apache.thrift.protocol.TField("twitter", org.apache.thrift.protocol.TType.STRING, (short)3);

  private String facebook; // required
  private String opensocial; // required
  private String twitter; // 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 {
    FACEBOOK((short)1, "facebook"),
    OPENSOCIAL((short)2, "opensocial"),
    TWITTER((short)3, "twitter");

    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: // FACEBOOK
          return FACEBOOK;
        case 2: // OPENSOCIAL
          return OPENSOCIAL;
        case 3: // TWITTER
          return TWITTER;
        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.FACEBOOK, new org.apache.thrift.meta_data.FieldMetaData("facebook", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.OPENSOCIAL, new org.apache.thrift.meta_data.FieldMetaData("opensocial", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TWITTER, new org.apache.thrift.meta_data.FieldMetaData("twitter", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SocialHandles.class, metaDataMap);
  }

  public SocialHandles() {
  }

  public SocialHandles(
    String facebook,
    String opensocial,
    String twitter)
  {
    this();
    this.facebook = facebook;
    this.opensocial = opensocial;
    this.twitter = twitter;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public SocialHandles(SocialHandles other) {
    if (other.isSetFacebook()) {
      this.facebook = other.facebook;
    }
    if (other.isSetOpensocial()) {
      this.opensocial = other.opensocial;
    }
    if (other.isSetTwitter()) {
      this.twitter = other.twitter;
    }
  }

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

  @Override
  public void clear() {
    this.facebook = null;
    this.opensocial = null;
    this.twitter = null;
  }

  public String getFacebook() {
    return this.facebook;
  }

  public void setFacebook(String facebook) {
    this.facebook = facebook;
  }

  public void unsetFacebook() {
    this.facebook = null;
  }

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

  public void setFacebookIsSet(boolean value) {
    if (!value) {
      this.facebook = null;
    }
  }

  public String getOpensocial() {
    return this.opensocial;
  }

  public void setOpensocial(String opensocial) {
    this.opensocial = opensocial;
  }

  public void unsetOpensocial() {
    this.opensocial = null;
  }

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

  public void setOpensocialIsSet(boolean value) {
    if (!value) {
      this.opensocial = null;
    }
  }

  public String getTwitter() {
    return this.twitter;
  }

  public void setTwitter(String twitter) {
    this.twitter = twitter;
  }

  public void unsetTwitter() {
    this.twitter = null;
  }

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

  public void setTwitterIsSet(boolean value) {
    if (!value) {
      this.twitter = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case FACEBOOK:
      if (value == null) {
        unsetFacebook();
      } else {
        setFacebook((String)value);
      }
      break;

    case OPENSOCIAL:
      if (value == null) {
        unsetOpensocial();
      } else {
        setOpensocial((String)value);
      }
      break;

    case TWITTER:
      if (value == null) {
        unsetTwitter();
      } else {
        setTwitter((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case FACEBOOK:
      return getFacebook();

    case OPENSOCIAL:
      return getOpensocial();

    case TWITTER:
      return getTwitter();

    }
    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 FACEBOOK:
      return isSetFacebook();
    case OPENSOCIAL:
      return isSetOpensocial();
    case TWITTER:
      return isSetTwitter();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_facebook = true && this.isSetFacebook();
    boolean that_present_facebook = true && that.isSetFacebook();
    if (this_present_facebook || that_present_facebook) {
      if (!(this_present_facebook && that_present_facebook))
        return false;
      if (!this.facebook.equals(that.facebook))
        return false;
    }

    boolean this_present_opensocial = true && this.isSetOpensocial();
    boolean that_present_opensocial = true && that.isSetOpensocial();
    if (this_present_opensocial || that_present_opensocial) {
      if (!(this_present_opensocial && that_present_opensocial))
        return false;
      if (!this.opensocial.equals(that.opensocial))
        return false;
    }

    boolean this_present_twitter = true && this.isSetTwitter();
    boolean that_present_twitter = true && that.isSetTwitter();
    if (this_present_twitter || that_present_twitter) {
      if (!(this_present_twitter && that_present_twitter))
        return false;
      if (!this.twitter.equals(that.twitter))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetFacebook()).compareTo(typedOther.isSetFacebook());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFacebook()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.facebook, typedOther.facebook);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOpensocial()).compareTo(typedOther.isSetOpensocial());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOpensocial()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.opensocial, typedOther.opensocial);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTwitter()).compareTo(typedOther.isSetTwitter());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTwitter()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.twitter, typedOther.twitter);
      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: // FACEBOOK
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.facebook = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // OPENSOCIAL
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.opensocial = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // TWITTER
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.twitter = iprot.readString();
          } 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.facebook != null) {
      oprot.writeFieldBegin(FACEBOOK_FIELD_DESC);
      oprot.writeString(this.facebook);
      oprot.writeFieldEnd();
    }
    if (this.opensocial != null) {
      oprot.writeFieldBegin(OPENSOCIAL_FIELD_DESC);
      oprot.writeString(this.opensocial);
      oprot.writeFieldEnd();
    }
    if (this.twitter != null) {
      oprot.writeFieldBegin(TWITTER_FIELD_DESC);
      oprot.writeString(this.twitter);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("facebook:");
    if (this.facebook == null) {
      sb.append("null");
    } else {
      sb.append(this.facebook);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("opensocial:");
    if (this.opensocial == null) {
      sb.append("null");
    } else {
      sb.append(this.opensocial);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("twitter:");
    if (this.twitter == null) {
      sb.append("null");
    } else {
      sb.append(this.twitter);
    }
    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);
    }
  }

}