Subversion Repositories SmartDukaan

Rev

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.googleadwords;

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 AdwordsAdGroupAd implements org.apache.thrift.TBase<AdwordsAdGroupAd, AdwordsAdGroupAd._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AdwordsAdGroupAd");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField CAMPAIGN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("campaignId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField ADGROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("adgroupId", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField ADGROUPAD_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("adgroupadId", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField HEADLINE_FIELD_DESC = new org.apache.thrift.protocol.TField("headline", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField DESCRIPTION1_FIELD_DESC = new org.apache.thrift.protocol.TField("description1", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField DESCRIPTION2_FIELD_DESC = new org.apache.thrift.protocol.TField("description2", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField URL_FIELD_DESC = new org.apache.thrift.protocol.TField("url", org.apache.thrift.protocol.TType.STRING, (short)8);
  private static final org.apache.thrift.protocol.TField DISPLAY_URL_FIELD_DESC = new org.apache.thrift.protocol.TField("displayUrl", org.apache.thrift.protocol.TType.STRING, (short)9);

  private long id; // required
  private long campaignId; // required
  private long adgroupId; // required
  private long adgroupadId; // required
  private String headline; // required
  private String description1; // required
  private String description2; // required
  private String url; // required
  private String displayUrl; // 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 {
    ID((short)1, "id"),
    CAMPAIGN_ID((short)2, "campaignId"),
    ADGROUP_ID((short)3, "adgroupId"),
    ADGROUPAD_ID((short)4, "adgroupadId"),
    HEADLINE((short)5, "headline"),
    DESCRIPTION1((short)6, "description1"),
    DESCRIPTION2((short)7, "description2"),
    URL((short)8, "url"),
    DISPLAY_URL((short)9, "displayUrl");

    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: // ID
          return ID;
        case 2: // CAMPAIGN_ID
          return CAMPAIGN_ID;
        case 3: // ADGROUP_ID
          return ADGROUP_ID;
        case 4: // ADGROUPAD_ID
          return ADGROUPAD_ID;
        case 5: // HEADLINE
          return HEADLINE;
        case 6: // DESCRIPTION1
          return DESCRIPTION1;
        case 7: // DESCRIPTION2
          return DESCRIPTION2;
        case 8: // URL
          return URL;
        case 9: // DISPLAY_URL
          return DISPLAY_URL;
        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
  private static final int __ID_ISSET_ID = 0;
  private static final int __CAMPAIGNID_ISSET_ID = 1;
  private static final int __ADGROUPID_ISSET_ID = 2;
  private static final int __ADGROUPADID_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CAMPAIGN_ID, new org.apache.thrift.meta_data.FieldMetaData("campaignId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ADGROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("adgroupId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ADGROUPAD_ID, new org.apache.thrift.meta_data.FieldMetaData("adgroupadId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.HEADLINE, new org.apache.thrift.meta_data.FieldMetaData("headline", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DESCRIPTION1, new org.apache.thrift.meta_data.FieldMetaData("description1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DESCRIPTION2, new org.apache.thrift.meta_data.FieldMetaData("description2", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.URL, new org.apache.thrift.meta_data.FieldMetaData("url", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DISPLAY_URL, new org.apache.thrift.meta_data.FieldMetaData("displayUrl", 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(AdwordsAdGroupAd.class, metaDataMap);
  }

  public AdwordsAdGroupAd() {
  }

  public AdwordsAdGroupAd(
    long id,
    long campaignId,
    long adgroupId,
    long adgroupadId,
    String headline,
    String description1,
    String description2,
    String url,
    String displayUrl)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.campaignId = campaignId;
    setCampaignIdIsSet(true);
    this.adgroupId = adgroupId;
    setAdgroupIdIsSet(true);
    this.adgroupadId = adgroupadId;
    setAdgroupadIdIsSet(true);
    this.headline = headline;
    this.description1 = description1;
    this.description2 = description2;
    this.url = url;
    this.displayUrl = displayUrl;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AdwordsAdGroupAd(AdwordsAdGroupAd other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.campaignId = other.campaignId;
    this.adgroupId = other.adgroupId;
    this.adgroupadId = other.adgroupadId;
    if (other.isSetHeadline()) {
      this.headline = other.headline;
    }
    if (other.isSetDescription1()) {
      this.description1 = other.description1;
    }
    if (other.isSetDescription2()) {
      this.description2 = other.description2;
    }
    if (other.isSetUrl()) {
      this.url = other.url;
    }
    if (other.isSetDisplayUrl()) {
      this.displayUrl = other.displayUrl;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    setCampaignIdIsSet(false);
    this.campaignId = 0;
    setAdgroupIdIsSet(false);
    this.adgroupId = 0;
    setAdgroupadIdIsSet(false);
    this.adgroupadId = 0;
    this.headline = null;
    this.description1 = null;
    this.description2 = null;
    this.url = null;
    this.displayUrl = null;
  }

  public long getId() {
    return this.id;
  }

  public void setId(long id) {
    this.id = id;
    setIdIsSet(true);
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been assigned a value) and false otherwise */
  public boolean isSetId() {
    return __isset_bit_vector.get(__ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

  public long getCampaignId() {
    return this.campaignId;
  }

  public void setCampaignId(long campaignId) {
    this.campaignId = campaignId;
    setCampaignIdIsSet(true);
  }

  public void unsetCampaignId() {
    __isset_bit_vector.clear(__CAMPAIGNID_ISSET_ID);
  }

  /** Returns true if field campaignId is set (has been assigned a value) and false otherwise */
  public boolean isSetCampaignId() {
    return __isset_bit_vector.get(__CAMPAIGNID_ISSET_ID);
  }

  public void setCampaignIdIsSet(boolean value) {
    __isset_bit_vector.set(__CAMPAIGNID_ISSET_ID, value);
  }

  public long getAdgroupId() {
    return this.adgroupId;
  }

  public void setAdgroupId(long adgroupId) {
    this.adgroupId = adgroupId;
    setAdgroupIdIsSet(true);
  }

  public void unsetAdgroupId() {
    __isset_bit_vector.clear(__ADGROUPID_ISSET_ID);
  }

  /** Returns true if field adgroupId is set (has been assigned a value) and false otherwise */
  public boolean isSetAdgroupId() {
    return __isset_bit_vector.get(__ADGROUPID_ISSET_ID);
  }

  public void setAdgroupIdIsSet(boolean value) {
    __isset_bit_vector.set(__ADGROUPID_ISSET_ID, value);
  }

  public long getAdgroupadId() {
    return this.adgroupadId;
  }

  public void setAdgroupadId(long adgroupadId) {
    this.adgroupadId = adgroupadId;
    setAdgroupadIdIsSet(true);
  }

  public void unsetAdgroupadId() {
    __isset_bit_vector.clear(__ADGROUPADID_ISSET_ID);
  }

  /** Returns true if field adgroupadId is set (has been assigned a value) and false otherwise */
  public boolean isSetAdgroupadId() {
    return __isset_bit_vector.get(__ADGROUPADID_ISSET_ID);
  }

  public void setAdgroupadIdIsSet(boolean value) {
    __isset_bit_vector.set(__ADGROUPADID_ISSET_ID, value);
  }

  public String getHeadline() {
    return this.headline;
  }

  public void setHeadline(String headline) {
    this.headline = headline;
  }

  public void unsetHeadline() {
    this.headline = null;
  }

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

  public void setHeadlineIsSet(boolean value) {
    if (!value) {
      this.headline = null;
    }
  }

  public String getDescription1() {
    return this.description1;
  }

  public void setDescription1(String description1) {
    this.description1 = description1;
  }

  public void unsetDescription1() {
    this.description1 = null;
  }

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

  public void setDescription1IsSet(boolean value) {
    if (!value) {
      this.description1 = null;
    }
  }

  public String getDescription2() {
    return this.description2;
  }

  public void setDescription2(String description2) {
    this.description2 = description2;
  }

  public void unsetDescription2() {
    this.description2 = null;
  }

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

  public void setDescription2IsSet(boolean value) {
    if (!value) {
      this.description2 = null;
    }
  }

  public String getUrl() {
    return this.url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  public void unsetUrl() {
    this.url = null;
  }

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

  public void setUrlIsSet(boolean value) {
    if (!value) {
      this.url = null;
    }
  }

  public String getDisplayUrl() {
    return this.displayUrl;
  }

  public void setDisplayUrl(String displayUrl) {
    this.displayUrl = displayUrl;
  }

  public void unsetDisplayUrl() {
    this.displayUrl = null;
  }

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

  public void setDisplayUrlIsSet(boolean value) {
    if (!value) {
      this.displayUrl = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((Long)value);
      }
      break;

    case CAMPAIGN_ID:
      if (value == null) {
        unsetCampaignId();
      } else {
        setCampaignId((Long)value);
      }
      break;

    case ADGROUP_ID:
      if (value == null) {
        unsetAdgroupId();
      } else {
        setAdgroupId((Long)value);
      }
      break;

    case ADGROUPAD_ID:
      if (value == null) {
        unsetAdgroupadId();
      } else {
        setAdgroupadId((Long)value);
      }
      break;

    case HEADLINE:
      if (value == null) {
        unsetHeadline();
      } else {
        setHeadline((String)value);
      }
      break;

    case DESCRIPTION1:
      if (value == null) {
        unsetDescription1();
      } else {
        setDescription1((String)value);
      }
      break;

    case DESCRIPTION2:
      if (value == null) {
        unsetDescription2();
      } else {
        setDescription2((String)value);
      }
      break;

    case URL:
      if (value == null) {
        unsetUrl();
      } else {
        setUrl((String)value);
      }
      break;

    case DISPLAY_URL:
      if (value == null) {
        unsetDisplayUrl();
      } else {
        setDisplayUrl((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return Long.valueOf(getId());

    case CAMPAIGN_ID:
      return Long.valueOf(getCampaignId());

    case ADGROUP_ID:
      return Long.valueOf(getAdgroupId());

    case ADGROUPAD_ID:
      return Long.valueOf(getAdgroupadId());

    case HEADLINE:
      return getHeadline();

    case DESCRIPTION1:
      return getDescription1();

    case DESCRIPTION2:
      return getDescription2();

    case URL:
      return getUrl();

    case DISPLAY_URL:
      return getDisplayUrl();

    }
    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 ID:
      return isSetId();
    case CAMPAIGN_ID:
      return isSetCampaignId();
    case ADGROUP_ID:
      return isSetAdgroupId();
    case ADGROUPAD_ID:
      return isSetAdgroupadId();
    case HEADLINE:
      return isSetHeadline();
    case DESCRIPTION1:
      return isSetDescription1();
    case DESCRIPTION2:
      return isSetDescription2();
    case URL:
      return isSetUrl();
    case DISPLAY_URL:
      return isSetDisplayUrl();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_campaignId = true;
    boolean that_present_campaignId = true;
    if (this_present_campaignId || that_present_campaignId) {
      if (!(this_present_campaignId && that_present_campaignId))
        return false;
      if (this.campaignId != that.campaignId)
        return false;
    }

    boolean this_present_adgroupId = true;
    boolean that_present_adgroupId = true;
    if (this_present_adgroupId || that_present_adgroupId) {
      if (!(this_present_adgroupId && that_present_adgroupId))
        return false;
      if (this.adgroupId != that.adgroupId)
        return false;
    }

    boolean this_present_adgroupadId = true;
    boolean that_present_adgroupadId = true;
    if (this_present_adgroupadId || that_present_adgroupadId) {
      if (!(this_present_adgroupadId && that_present_adgroupadId))
        return false;
      if (this.adgroupadId != that.adgroupadId)
        return false;
    }

    boolean this_present_headline = true && this.isSetHeadline();
    boolean that_present_headline = true && that.isSetHeadline();
    if (this_present_headline || that_present_headline) {
      if (!(this_present_headline && that_present_headline))
        return false;
      if (!this.headline.equals(that.headline))
        return false;
    }

    boolean this_present_description1 = true && this.isSetDescription1();
    boolean that_present_description1 = true && that.isSetDescription1();
    if (this_present_description1 || that_present_description1) {
      if (!(this_present_description1 && that_present_description1))
        return false;
      if (!this.description1.equals(that.description1))
        return false;
    }

    boolean this_present_description2 = true && this.isSetDescription2();
    boolean that_present_description2 = true && that.isSetDescription2();
    if (this_present_description2 || that_present_description2) {
      if (!(this_present_description2 && that_present_description2))
        return false;
      if (!this.description2.equals(that.description2))
        return false;
    }

    boolean this_present_url = true && this.isSetUrl();
    boolean that_present_url = true && that.isSetUrl();
    if (this_present_url || that_present_url) {
      if (!(this_present_url && that_present_url))
        return false;
      if (!this.url.equals(that.url))
        return false;
    }

    boolean this_present_displayUrl = true && this.isSetDisplayUrl();
    boolean that_present_displayUrl = true && that.isSetDisplayUrl();
    if (this_present_displayUrl || that_present_displayUrl) {
      if (!(this_present_displayUrl && that_present_displayUrl))
        return false;
      if (!this.displayUrl.equals(that.displayUrl))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCampaignId()).compareTo(typedOther.isSetCampaignId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCampaignId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.campaignId, typedOther.campaignId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAdgroupId()).compareTo(typedOther.isSetAdgroupId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAdgroupId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.adgroupId, typedOther.adgroupId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAdgroupadId()).compareTo(typedOther.isSetAdgroupadId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAdgroupadId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.adgroupadId, typedOther.adgroupadId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHeadline()).compareTo(typedOther.isSetHeadline());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHeadline()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headline, typedOther.headline);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDescription1()).compareTo(typedOther.isSetDescription1());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDescription1()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description1, typedOther.description1);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDescription2()).compareTo(typedOther.isSetDescription2());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDescription2()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description2, typedOther.description2);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUrl()).compareTo(typedOther.isSetUrl());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUrl()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.url, typedOther.url);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDisplayUrl()).compareTo(typedOther.isSetDisplayUrl());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDisplayUrl()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.displayUrl, typedOther.displayUrl);
      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: // ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.id = iprot.readI64();
            setIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // CAMPAIGN_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.campaignId = iprot.readI64();
            setCampaignIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // ADGROUP_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.adgroupId = iprot.readI64();
            setAdgroupIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // ADGROUPAD_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.adgroupadId = iprot.readI64();
            setAdgroupadIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // HEADLINE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.headline = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // DESCRIPTION1
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.description1 = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // DESCRIPTION2
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.description2 = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // URL
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.url = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // DISPLAY_URL
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.displayUrl = 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);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CAMPAIGN_ID_FIELD_DESC);
    oprot.writeI64(this.campaignId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ADGROUP_ID_FIELD_DESC);
    oprot.writeI64(this.adgroupId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ADGROUPAD_ID_FIELD_DESC);
    oprot.writeI64(this.adgroupadId);
    oprot.writeFieldEnd();
    if (this.headline != null) {
      oprot.writeFieldBegin(HEADLINE_FIELD_DESC);
      oprot.writeString(this.headline);
      oprot.writeFieldEnd();
    }
    if (this.description1 != null) {
      oprot.writeFieldBegin(DESCRIPTION1_FIELD_DESC);
      oprot.writeString(this.description1);
      oprot.writeFieldEnd();
    }
    if (this.description2 != null) {
      oprot.writeFieldBegin(DESCRIPTION2_FIELD_DESC);
      oprot.writeString(this.description2);
      oprot.writeFieldEnd();
    }
    if (this.url != null) {
      oprot.writeFieldBegin(URL_FIELD_DESC);
      oprot.writeString(this.url);
      oprot.writeFieldEnd();
    }
    if (this.displayUrl != null) {
      oprot.writeFieldBegin(DISPLAY_URL_FIELD_DESC);
      oprot.writeString(this.displayUrl);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("campaignId:");
    sb.append(this.campaignId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("adgroupId:");
    sb.append(this.adgroupId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("adgroupadId:");
    sb.append(this.adgroupadId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("headline:");
    if (this.headline == null) {
      sb.append("null");
    } else {
      sb.append(this.headline);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("description1:");
    if (this.description1 == null) {
      sb.append("null");
    } else {
      sb.append(this.description1);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("description2:");
    if (this.description2 == null) {
      sb.append("null");
    } else {
      sb.append(this.description2);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("url:");
    if (this.url == null) {
      sb.append("null");
    } else {
      sb.append(this.url);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("displayUrl:");
    if (this.displayUrl == null) {
      sb.append("null");
    } else {
      sb.append(this.displayUrl);
    }
    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 {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bit_vector = new BitSet(1);
      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);
    }
  }

}