Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
9048 manish.sha 1
/**
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.googleadwords;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
18
import java.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class AdwordsAdKeyword implements org.apache.thrift.TBase<AdwordsAdKeyword, AdwordsAdKeyword._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AdwordsAdKeyword");
25
 
26
  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);
27
  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);
28
  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);
29
  private static final org.apache.thrift.protocol.TField CRITERION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("criterionId", org.apache.thrift.protocol.TType.I64, (short)4);
30
  private static final org.apache.thrift.protocol.TField TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("text", org.apache.thrift.protocol.TType.STRING, (short)5);
31
  private static final org.apache.thrift.protocol.TField BID_AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("bidAmount", org.apache.thrift.protocol.TType.DOUBLE, (short)6);
32
  private static final org.apache.thrift.protocol.TField MATCH_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("matchType", org.apache.thrift.protocol.TType.I32, (short)7);
33
 
34
  private long id; // required
35
  private long campaignId; // required
36
  private long adgroupId; // required
37
  private long criterionId; // required
38
  private String text; // required
39
  private double bidAmount; // required
40
  private KeywordMatchType matchType; // required
41
 
42
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
43
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
44
    ID((short)1, "id"),
45
    CAMPAIGN_ID((short)2, "campaignId"),
46
    ADGROUP_ID((short)3, "adgroupId"),
47
    CRITERION_ID((short)4, "criterionId"),
48
    TEXT((short)5, "text"),
49
    BID_AMOUNT((short)6, "bidAmount"),
50
    /**
51
     * 
52
     * @see KeywordMatchType
53
     */
54
    MATCH_TYPE((short)7, "matchType");
55
 
56
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
57
 
58
    static {
59
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
60
        byName.put(field.getFieldName(), field);
61
      }
62
    }
63
 
64
    /**
65
     * Find the _Fields constant that matches fieldId, or null if its not found.
66
     */
67
    public static _Fields findByThriftId(int fieldId) {
68
      switch(fieldId) {
69
        case 1: // ID
70
          return ID;
71
        case 2: // CAMPAIGN_ID
72
          return CAMPAIGN_ID;
73
        case 3: // ADGROUP_ID
74
          return ADGROUP_ID;
75
        case 4: // CRITERION_ID
76
          return CRITERION_ID;
77
        case 5: // TEXT
78
          return TEXT;
79
        case 6: // BID_AMOUNT
80
          return BID_AMOUNT;
81
        case 7: // MATCH_TYPE
82
          return MATCH_TYPE;
83
        default:
84
          return null;
85
      }
86
    }
87
 
88
    /**
89
     * Find the _Fields constant that matches fieldId, throwing an exception
90
     * if it is not found.
91
     */
92
    public static _Fields findByThriftIdOrThrow(int fieldId) {
93
      _Fields fields = findByThriftId(fieldId);
94
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
95
      return fields;
96
    }
97
 
98
    /**
99
     * Find the _Fields constant that matches name, or null if its not found.
100
     */
101
    public static _Fields findByName(String name) {
102
      return byName.get(name);
103
    }
104
 
105
    private final short _thriftId;
106
    private final String _fieldName;
107
 
108
    _Fields(short thriftId, String fieldName) {
109
      _thriftId = thriftId;
110
      _fieldName = fieldName;
111
    }
112
 
113
    public short getThriftFieldId() {
114
      return _thriftId;
115
    }
116
 
117
    public String getFieldName() {
118
      return _fieldName;
119
    }
120
  }
121
 
122
  // isset id assignments
123
  private static final int __ID_ISSET_ID = 0;
124
  private static final int __CAMPAIGNID_ISSET_ID = 1;
125
  private static final int __ADGROUPID_ISSET_ID = 2;
126
  private static final int __CRITERIONID_ISSET_ID = 3;
127
  private static final int __BIDAMOUNT_ISSET_ID = 4;
128
  private BitSet __isset_bit_vector = new BitSet(5);
129
 
130
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
131
  static {
132
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
133
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
134
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
135
    tmpMap.put(_Fields.CAMPAIGN_ID, new org.apache.thrift.meta_data.FieldMetaData("campaignId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
136
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
137
    tmpMap.put(_Fields.ADGROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("adgroupId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
138
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
139
    tmpMap.put(_Fields.CRITERION_ID, new org.apache.thrift.meta_data.FieldMetaData("criterionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
140
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
141
    tmpMap.put(_Fields.TEXT, new org.apache.thrift.meta_data.FieldMetaData("text", org.apache.thrift.TFieldRequirementType.DEFAULT, 
142
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
143
    tmpMap.put(_Fields.BID_AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("bidAmount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
144
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
145
    tmpMap.put(_Fields.MATCH_TYPE, new org.apache.thrift.meta_data.FieldMetaData("matchType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
146
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, KeywordMatchType.class)));
147
    metaDataMap = Collections.unmodifiableMap(tmpMap);
148
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AdwordsAdKeyword.class, metaDataMap);
149
  }
150
 
151
  public AdwordsAdKeyword() {
152
  }
153
 
154
  public AdwordsAdKeyword(
155
    long id,
156
    long campaignId,
157
    long adgroupId,
158
    long criterionId,
159
    String text,
160
    double bidAmount,
161
    KeywordMatchType matchType)
162
  {
163
    this();
164
    this.id = id;
165
    setIdIsSet(true);
166
    this.campaignId = campaignId;
167
    setCampaignIdIsSet(true);
168
    this.adgroupId = adgroupId;
169
    setAdgroupIdIsSet(true);
170
    this.criterionId = criterionId;
171
    setCriterionIdIsSet(true);
172
    this.text = text;
173
    this.bidAmount = bidAmount;
174
    setBidAmountIsSet(true);
175
    this.matchType = matchType;
176
  }
177
 
178
  /**
179
   * Performs a deep copy on <i>other</i>.
180
   */
181
  public AdwordsAdKeyword(AdwordsAdKeyword other) {
182
    __isset_bit_vector.clear();
183
    __isset_bit_vector.or(other.__isset_bit_vector);
184
    this.id = other.id;
185
    this.campaignId = other.campaignId;
186
    this.adgroupId = other.adgroupId;
187
    this.criterionId = other.criterionId;
188
    if (other.isSetText()) {
189
      this.text = other.text;
190
    }
191
    this.bidAmount = other.bidAmount;
192
    if (other.isSetMatchType()) {
193
      this.matchType = other.matchType;
194
    }
195
  }
196
 
197
  public AdwordsAdKeyword deepCopy() {
198
    return new AdwordsAdKeyword(this);
199
  }
200
 
201
  @Override
202
  public void clear() {
203
    setIdIsSet(false);
204
    this.id = 0;
205
    setCampaignIdIsSet(false);
206
    this.campaignId = 0;
207
    setAdgroupIdIsSet(false);
208
    this.adgroupId = 0;
209
    setCriterionIdIsSet(false);
210
    this.criterionId = 0;
211
    this.text = null;
212
    setBidAmountIsSet(false);
213
    this.bidAmount = 0.0;
214
    this.matchType = null;
215
  }
216
 
217
  public long getId() {
218
    return this.id;
219
  }
220
 
221
  public void setId(long id) {
222
    this.id = id;
223
    setIdIsSet(true);
224
  }
225
 
226
  public void unsetId() {
227
    __isset_bit_vector.clear(__ID_ISSET_ID);
228
  }
229
 
230
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
231
  public boolean isSetId() {
232
    return __isset_bit_vector.get(__ID_ISSET_ID);
233
  }
234
 
235
  public void setIdIsSet(boolean value) {
236
    __isset_bit_vector.set(__ID_ISSET_ID, value);
237
  }
238
 
239
  public long getCampaignId() {
240
    return this.campaignId;
241
  }
242
 
243
  public void setCampaignId(long campaignId) {
244
    this.campaignId = campaignId;
245
    setCampaignIdIsSet(true);
246
  }
247
 
248
  public void unsetCampaignId() {
249
    __isset_bit_vector.clear(__CAMPAIGNID_ISSET_ID);
250
  }
251
 
252
  /** Returns true if field campaignId is set (has been assigned a value) and false otherwise */
253
  public boolean isSetCampaignId() {
254
    return __isset_bit_vector.get(__CAMPAIGNID_ISSET_ID);
255
  }
256
 
257
  public void setCampaignIdIsSet(boolean value) {
258
    __isset_bit_vector.set(__CAMPAIGNID_ISSET_ID, value);
259
  }
260
 
261
  public long getAdgroupId() {
262
    return this.adgroupId;
263
  }
264
 
265
  public void setAdgroupId(long adgroupId) {
266
    this.adgroupId = adgroupId;
267
    setAdgroupIdIsSet(true);
268
  }
269
 
270
  public void unsetAdgroupId() {
271
    __isset_bit_vector.clear(__ADGROUPID_ISSET_ID);
272
  }
273
 
274
  /** Returns true if field adgroupId is set (has been assigned a value) and false otherwise */
275
  public boolean isSetAdgroupId() {
276
    return __isset_bit_vector.get(__ADGROUPID_ISSET_ID);
277
  }
278
 
279
  public void setAdgroupIdIsSet(boolean value) {
280
    __isset_bit_vector.set(__ADGROUPID_ISSET_ID, value);
281
  }
282
 
283
  public long getCriterionId() {
284
    return this.criterionId;
285
  }
286
 
287
  public void setCriterionId(long criterionId) {
288
    this.criterionId = criterionId;
289
    setCriterionIdIsSet(true);
290
  }
291
 
292
  public void unsetCriterionId() {
293
    __isset_bit_vector.clear(__CRITERIONID_ISSET_ID);
294
  }
295
 
296
  /** Returns true if field criterionId is set (has been assigned a value) and false otherwise */
297
  public boolean isSetCriterionId() {
298
    return __isset_bit_vector.get(__CRITERIONID_ISSET_ID);
299
  }
300
 
301
  public void setCriterionIdIsSet(boolean value) {
302
    __isset_bit_vector.set(__CRITERIONID_ISSET_ID, value);
303
  }
304
 
305
  public String getText() {
306
    return this.text;
307
  }
308
 
309
  public void setText(String text) {
310
    this.text = text;
311
  }
312
 
313
  public void unsetText() {
314
    this.text = null;
315
  }
316
 
317
  /** Returns true if field text is set (has been assigned a value) and false otherwise */
318
  public boolean isSetText() {
319
    return this.text != null;
320
  }
321
 
322
  public void setTextIsSet(boolean value) {
323
    if (!value) {
324
      this.text = null;
325
    }
326
  }
327
 
328
  public double getBidAmount() {
329
    return this.bidAmount;
330
  }
331
 
332
  public void setBidAmount(double bidAmount) {
333
    this.bidAmount = bidAmount;
334
    setBidAmountIsSet(true);
335
  }
336
 
337
  public void unsetBidAmount() {
338
    __isset_bit_vector.clear(__BIDAMOUNT_ISSET_ID);
339
  }
340
 
341
  /** Returns true if field bidAmount is set (has been assigned a value) and false otherwise */
342
  public boolean isSetBidAmount() {
343
    return __isset_bit_vector.get(__BIDAMOUNT_ISSET_ID);
344
  }
345
 
346
  public void setBidAmountIsSet(boolean value) {
347
    __isset_bit_vector.set(__BIDAMOUNT_ISSET_ID, value);
348
  }
349
 
350
  /**
351
   * 
352
   * @see KeywordMatchType
353
   */
354
  public KeywordMatchType getMatchType() {
355
    return this.matchType;
356
  }
357
 
358
  /**
359
   * 
360
   * @see KeywordMatchType
361
   */
362
  public void setMatchType(KeywordMatchType matchType) {
363
    this.matchType = matchType;
364
  }
365
 
366
  public void unsetMatchType() {
367
    this.matchType = null;
368
  }
369
 
370
  /** Returns true if field matchType is set (has been assigned a value) and false otherwise */
371
  public boolean isSetMatchType() {
372
    return this.matchType != null;
373
  }
374
 
375
  public void setMatchTypeIsSet(boolean value) {
376
    if (!value) {
377
      this.matchType = null;
378
    }
379
  }
380
 
381
  public void setFieldValue(_Fields field, Object value) {
382
    switch (field) {
383
    case ID:
384
      if (value == null) {
385
        unsetId();
386
      } else {
387
        setId((Long)value);
388
      }
389
      break;
390
 
391
    case CAMPAIGN_ID:
392
      if (value == null) {
393
        unsetCampaignId();
394
      } else {
395
        setCampaignId((Long)value);
396
      }
397
      break;
398
 
399
    case ADGROUP_ID:
400
      if (value == null) {
401
        unsetAdgroupId();
402
      } else {
403
        setAdgroupId((Long)value);
404
      }
405
      break;
406
 
407
    case CRITERION_ID:
408
      if (value == null) {
409
        unsetCriterionId();
410
      } else {
411
        setCriterionId((Long)value);
412
      }
413
      break;
414
 
415
    case TEXT:
416
      if (value == null) {
417
        unsetText();
418
      } else {
419
        setText((String)value);
420
      }
421
      break;
422
 
423
    case BID_AMOUNT:
424
      if (value == null) {
425
        unsetBidAmount();
426
      } else {
427
        setBidAmount((Double)value);
428
      }
429
      break;
430
 
431
    case MATCH_TYPE:
432
      if (value == null) {
433
        unsetMatchType();
434
      } else {
435
        setMatchType((KeywordMatchType)value);
436
      }
437
      break;
438
 
439
    }
440
  }
441
 
442
  public Object getFieldValue(_Fields field) {
443
    switch (field) {
444
    case ID:
445
      return Long.valueOf(getId());
446
 
447
    case CAMPAIGN_ID:
448
      return Long.valueOf(getCampaignId());
449
 
450
    case ADGROUP_ID:
451
      return Long.valueOf(getAdgroupId());
452
 
453
    case CRITERION_ID:
454
      return Long.valueOf(getCriterionId());
455
 
456
    case TEXT:
457
      return getText();
458
 
459
    case BID_AMOUNT:
460
      return Double.valueOf(getBidAmount());
461
 
462
    case MATCH_TYPE:
463
      return getMatchType();
464
 
465
    }
466
    throw new IllegalStateException();
467
  }
468
 
469
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
470
  public boolean isSet(_Fields field) {
471
    if (field == null) {
472
      throw new IllegalArgumentException();
473
    }
474
 
475
    switch (field) {
476
    case ID:
477
      return isSetId();
478
    case CAMPAIGN_ID:
479
      return isSetCampaignId();
480
    case ADGROUP_ID:
481
      return isSetAdgroupId();
482
    case CRITERION_ID:
483
      return isSetCriterionId();
484
    case TEXT:
485
      return isSetText();
486
    case BID_AMOUNT:
487
      return isSetBidAmount();
488
    case MATCH_TYPE:
489
      return isSetMatchType();
490
    }
491
    throw new IllegalStateException();
492
  }
493
 
494
  @Override
495
  public boolean equals(Object that) {
496
    if (that == null)
497
      return false;
498
    if (that instanceof AdwordsAdKeyword)
499
      return this.equals((AdwordsAdKeyword)that);
500
    return false;
501
  }
502
 
503
  public boolean equals(AdwordsAdKeyword that) {
504
    if (that == null)
505
      return false;
506
 
507
    boolean this_present_id = true;
508
    boolean that_present_id = true;
509
    if (this_present_id || that_present_id) {
510
      if (!(this_present_id && that_present_id))
511
        return false;
512
      if (this.id != that.id)
513
        return false;
514
    }
515
 
516
    boolean this_present_campaignId = true;
517
    boolean that_present_campaignId = true;
518
    if (this_present_campaignId || that_present_campaignId) {
519
      if (!(this_present_campaignId && that_present_campaignId))
520
        return false;
521
      if (this.campaignId != that.campaignId)
522
        return false;
523
    }
524
 
525
    boolean this_present_adgroupId = true;
526
    boolean that_present_adgroupId = true;
527
    if (this_present_adgroupId || that_present_adgroupId) {
528
      if (!(this_present_adgroupId && that_present_adgroupId))
529
        return false;
530
      if (this.adgroupId != that.adgroupId)
531
        return false;
532
    }
533
 
534
    boolean this_present_criterionId = true;
535
    boolean that_present_criterionId = true;
536
    if (this_present_criterionId || that_present_criterionId) {
537
      if (!(this_present_criterionId && that_present_criterionId))
538
        return false;
539
      if (this.criterionId != that.criterionId)
540
        return false;
541
    }
542
 
543
    boolean this_present_text = true && this.isSetText();
544
    boolean that_present_text = true && that.isSetText();
545
    if (this_present_text || that_present_text) {
546
      if (!(this_present_text && that_present_text))
547
        return false;
548
      if (!this.text.equals(that.text))
549
        return false;
550
    }
551
 
552
    boolean this_present_bidAmount = true;
553
    boolean that_present_bidAmount = true;
554
    if (this_present_bidAmount || that_present_bidAmount) {
555
      if (!(this_present_bidAmount && that_present_bidAmount))
556
        return false;
557
      if (this.bidAmount != that.bidAmount)
558
        return false;
559
    }
560
 
561
    boolean this_present_matchType = true && this.isSetMatchType();
562
    boolean that_present_matchType = true && that.isSetMatchType();
563
    if (this_present_matchType || that_present_matchType) {
564
      if (!(this_present_matchType && that_present_matchType))
565
        return false;
566
      if (!this.matchType.equals(that.matchType))
567
        return false;
568
    }
569
 
570
    return true;
571
  }
572
 
573
  @Override
574
  public int hashCode() {
575
    return 0;
576
  }
577
 
578
  public int compareTo(AdwordsAdKeyword other) {
579
    if (!getClass().equals(other.getClass())) {
580
      return getClass().getName().compareTo(other.getClass().getName());
581
    }
582
 
583
    int lastComparison = 0;
584
    AdwordsAdKeyword typedOther = (AdwordsAdKeyword)other;
585
 
586
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
587
    if (lastComparison != 0) {
588
      return lastComparison;
589
    }
590
    if (isSetId()) {
591
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
592
      if (lastComparison != 0) {
593
        return lastComparison;
594
      }
595
    }
596
    lastComparison = Boolean.valueOf(isSetCampaignId()).compareTo(typedOther.isSetCampaignId());
597
    if (lastComparison != 0) {
598
      return lastComparison;
599
    }
600
    if (isSetCampaignId()) {
601
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.campaignId, typedOther.campaignId);
602
      if (lastComparison != 0) {
603
        return lastComparison;
604
      }
605
    }
606
    lastComparison = Boolean.valueOf(isSetAdgroupId()).compareTo(typedOther.isSetAdgroupId());
607
    if (lastComparison != 0) {
608
      return lastComparison;
609
    }
610
    if (isSetAdgroupId()) {
611
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.adgroupId, typedOther.adgroupId);
612
      if (lastComparison != 0) {
613
        return lastComparison;
614
      }
615
    }
616
    lastComparison = Boolean.valueOf(isSetCriterionId()).compareTo(typedOther.isSetCriterionId());
617
    if (lastComparison != 0) {
618
      return lastComparison;
619
    }
620
    if (isSetCriterionId()) {
621
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.criterionId, typedOther.criterionId);
622
      if (lastComparison != 0) {
623
        return lastComparison;
624
      }
625
    }
626
    lastComparison = Boolean.valueOf(isSetText()).compareTo(typedOther.isSetText());
627
    if (lastComparison != 0) {
628
      return lastComparison;
629
    }
630
    if (isSetText()) {
631
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.text, typedOther.text);
632
      if (lastComparison != 0) {
633
        return lastComparison;
634
      }
635
    }
636
    lastComparison = Boolean.valueOf(isSetBidAmount()).compareTo(typedOther.isSetBidAmount());
637
    if (lastComparison != 0) {
638
      return lastComparison;
639
    }
640
    if (isSetBidAmount()) {
641
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bidAmount, typedOther.bidAmount);
642
      if (lastComparison != 0) {
643
        return lastComparison;
644
      }
645
    }
646
    lastComparison = Boolean.valueOf(isSetMatchType()).compareTo(typedOther.isSetMatchType());
647
    if (lastComparison != 0) {
648
      return lastComparison;
649
    }
650
    if (isSetMatchType()) {
651
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.matchType, typedOther.matchType);
652
      if (lastComparison != 0) {
653
        return lastComparison;
654
      }
655
    }
656
    return 0;
657
  }
658
 
659
  public _Fields fieldForId(int fieldId) {
660
    return _Fields.findByThriftId(fieldId);
661
  }
662
 
663
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
664
    org.apache.thrift.protocol.TField field;
665
    iprot.readStructBegin();
666
    while (true)
667
    {
668
      field = iprot.readFieldBegin();
669
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
670
        break;
671
      }
672
      switch (field.id) {
673
        case 1: // ID
674
          if (field.type == org.apache.thrift.protocol.TType.I64) {
675
            this.id = iprot.readI64();
676
            setIdIsSet(true);
677
          } else { 
678
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
679
          }
680
          break;
681
        case 2: // CAMPAIGN_ID
682
          if (field.type == org.apache.thrift.protocol.TType.I64) {
683
            this.campaignId = iprot.readI64();
684
            setCampaignIdIsSet(true);
685
          } else { 
686
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
687
          }
688
          break;
689
        case 3: // ADGROUP_ID
690
          if (field.type == org.apache.thrift.protocol.TType.I64) {
691
            this.adgroupId = iprot.readI64();
692
            setAdgroupIdIsSet(true);
693
          } else { 
694
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
695
          }
696
          break;
697
        case 4: // CRITERION_ID
698
          if (field.type == org.apache.thrift.protocol.TType.I64) {
699
            this.criterionId = iprot.readI64();
700
            setCriterionIdIsSet(true);
701
          } else { 
702
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
703
          }
704
          break;
705
        case 5: // TEXT
706
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
707
            this.text = iprot.readString();
708
          } else { 
709
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
710
          }
711
          break;
712
        case 6: // BID_AMOUNT
713
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
714
            this.bidAmount = iprot.readDouble();
715
            setBidAmountIsSet(true);
716
          } else { 
717
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
718
          }
719
          break;
720
        case 7: // MATCH_TYPE
721
          if (field.type == org.apache.thrift.protocol.TType.I32) {
722
            this.matchType = KeywordMatchType.findByValue(iprot.readI32());
723
          } else { 
724
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
725
          }
726
          break;
727
        default:
728
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
729
      }
730
      iprot.readFieldEnd();
731
    }
732
    iprot.readStructEnd();
733
    validate();
734
  }
735
 
736
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
737
    validate();
738
 
739
    oprot.writeStructBegin(STRUCT_DESC);
740
    oprot.writeFieldBegin(ID_FIELD_DESC);
741
    oprot.writeI64(this.id);
742
    oprot.writeFieldEnd();
743
    oprot.writeFieldBegin(CAMPAIGN_ID_FIELD_DESC);
744
    oprot.writeI64(this.campaignId);
745
    oprot.writeFieldEnd();
746
    oprot.writeFieldBegin(ADGROUP_ID_FIELD_DESC);
747
    oprot.writeI64(this.adgroupId);
748
    oprot.writeFieldEnd();
749
    oprot.writeFieldBegin(CRITERION_ID_FIELD_DESC);
750
    oprot.writeI64(this.criterionId);
751
    oprot.writeFieldEnd();
752
    if (this.text != null) {
753
      oprot.writeFieldBegin(TEXT_FIELD_DESC);
754
      oprot.writeString(this.text);
755
      oprot.writeFieldEnd();
756
    }
757
    oprot.writeFieldBegin(BID_AMOUNT_FIELD_DESC);
758
    oprot.writeDouble(this.bidAmount);
759
    oprot.writeFieldEnd();
760
    if (this.matchType != null) {
761
      oprot.writeFieldBegin(MATCH_TYPE_FIELD_DESC);
762
      oprot.writeI32(this.matchType.getValue());
763
      oprot.writeFieldEnd();
764
    }
765
    oprot.writeFieldStop();
766
    oprot.writeStructEnd();
767
  }
768
 
769
  @Override
770
  public String toString() {
771
    StringBuilder sb = new StringBuilder("AdwordsAdKeyword(");
772
    boolean first = true;
773
 
774
    sb.append("id:");
775
    sb.append(this.id);
776
    first = false;
777
    if (!first) sb.append(", ");
778
    sb.append("campaignId:");
779
    sb.append(this.campaignId);
780
    first = false;
781
    if (!first) sb.append(", ");
782
    sb.append("adgroupId:");
783
    sb.append(this.adgroupId);
784
    first = false;
785
    if (!first) sb.append(", ");
786
    sb.append("criterionId:");
787
    sb.append(this.criterionId);
788
    first = false;
789
    if (!first) sb.append(", ");
790
    sb.append("text:");
791
    if (this.text == null) {
792
      sb.append("null");
793
    } else {
794
      sb.append(this.text);
795
    }
796
    first = false;
797
    if (!first) sb.append(", ");
798
    sb.append("bidAmount:");
799
    sb.append(this.bidAmount);
800
    first = false;
801
    if (!first) sb.append(", ");
802
    sb.append("matchType:");
803
    if (this.matchType == null) {
804
      sb.append("null");
805
    } else {
806
      sb.append(this.matchType);
807
    }
808
    first = false;
809
    sb.append(")");
810
    return sb.toString();
811
  }
812
 
813
  public void validate() throws org.apache.thrift.TException {
814
    // check for required fields
815
  }
816
 
817
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
818
    try {
819
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
820
    } catch (org.apache.thrift.TException te) {
821
      throw new java.io.IOException(te);
822
    }
823
  }
824
 
825
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
826
    try {
827
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
828
      __isset_bit_vector = new BitSet(1);
829
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
830
    } catch (org.apache.thrift.TException te) {
831
      throw new java.io.IOException(te);
832
    }
833
  }
834
 
835
}
836