Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
352 ashish 1
/**
2
 * Autogenerated by Thrift
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.utils;
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.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class Mail implements TBase<Mail._Fields>, java.io.Serializable, Cloneable, Comparable<Mail> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Mail");
28
 
29
  private static final TField TO_FIELD_DESC = new TField("to", TType.LIST, (short)1);
30
  private static final TField SUBJECT_FIELD_DESC = new TField("subject", TType.STRING, (short)2);
31
  private static final TField DATA_FIELD_DESC = new TField("data", TType.STRING, (short)3);
32
  private static final TField SENDER_FIELD_DESC = new TField("sender", TType.STRING, (short)4);
33
  private static final TField ATTACHMENTS_FIELD_DESC = new TField("attachments", TType.LIST, (short)5);
34
  private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)6);
35
 
36
  private List<String> to;
37
  private String subject;
38
  private String data;
39
  private String sender;
40
  private List<String> attachments;
41
  private String password;
42
 
43
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
44
  public enum _Fields implements TFieldIdEnum {
45
    TO((short)1, "to"),
46
    SUBJECT((short)2, "subject"),
47
    DATA((short)3, "data"),
48
    SENDER((short)4, "sender"),
49
    ATTACHMENTS((short)5, "attachments"),
50
    PASSWORD((short)6, "password");
51
 
52
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
53
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
54
 
55
    static {
56
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
57
        byId.put((int)field._thriftId, field);
58
        byName.put(field.getFieldName(), field);
59
      }
60
    }
61
 
62
    /**
63
     * Find the _Fields constant that matches fieldId, or null if its not found.
64
     */
65
    public static _Fields findByThriftId(int fieldId) {
66
      return byId.get(fieldId);
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
 
105
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
106
    put(_Fields.TO, new FieldMetaData("to", TFieldRequirementType.DEFAULT, 
107
        new ListMetaData(TType.LIST, 
108
            new FieldValueMetaData(TType.STRING))));
109
    put(_Fields.SUBJECT, new FieldMetaData("subject", TFieldRequirementType.DEFAULT, 
110
        new FieldValueMetaData(TType.STRING)));
111
    put(_Fields.DATA, new FieldMetaData("data", TFieldRequirementType.DEFAULT, 
112
        new FieldValueMetaData(TType.STRING)));
113
    put(_Fields.SENDER, new FieldMetaData("sender", TFieldRequirementType.DEFAULT, 
114
        new FieldValueMetaData(TType.STRING)));
115
    put(_Fields.ATTACHMENTS, new FieldMetaData("attachments", TFieldRequirementType.DEFAULT, 
116
        new ListMetaData(TType.LIST, 
117
            new FieldValueMetaData(TType.STRING))));
118
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
119
        new FieldValueMetaData(TType.STRING)));
120
  }});
121
 
122
  static {
123
    FieldMetaData.addStructMetaDataMap(Mail.class, metaDataMap);
124
  }
125
 
126
  public Mail() {
127
  }
128
 
129
  public Mail(
130
    List<String> to,
131
    String subject,
132
    String data,
133
    String sender,
134
    List<String> attachments,
135
    String password)
136
  {
137
    this();
138
    this.to = to;
139
    this.subject = subject;
140
    this.data = data;
141
    this.sender = sender;
142
    this.attachments = attachments;
143
    this.password = password;
144
  }
145
 
146
  /**
147
   * Performs a deep copy on <i>other</i>.
148
   */
149
  public Mail(Mail other) {
150
    if (other.isSetTo()) {
151
      List<String> __this__to = new ArrayList<String>();
152
      for (String other_element : other.to) {
153
        __this__to.add(other_element);
154
      }
155
      this.to = __this__to;
156
    }
157
    if (other.isSetSubject()) {
158
      this.subject = other.subject;
159
    }
160
    if (other.isSetData()) {
161
      this.data = other.data;
162
    }
163
    if (other.isSetSender()) {
164
      this.sender = other.sender;
165
    }
166
    if (other.isSetAttachments()) {
167
      List<String> __this__attachments = new ArrayList<String>();
168
      for (String other_element : other.attachments) {
169
        __this__attachments.add(other_element);
170
      }
171
      this.attachments = __this__attachments;
172
    }
173
    if (other.isSetPassword()) {
174
      this.password = other.password;
175
    }
176
  }
177
 
178
  public Mail deepCopy() {
179
    return new Mail(this);
180
  }
181
 
182
  @Deprecated
183
  public Mail clone() {
184
    return new Mail(this);
185
  }
186
 
187
  public int getToSize() {
188
    return (this.to == null) ? 0 : this.to.size();
189
  }
190
 
191
  public java.util.Iterator<String> getToIterator() {
192
    return (this.to == null) ? null : this.to.iterator();
193
  }
194
 
195
  public void addToTo(String elem) {
196
    if (this.to == null) {
197
      this.to = new ArrayList<String>();
198
    }
199
    this.to.add(elem);
200
  }
201
 
202
  public List<String> getTo() {
203
    return this.to;
204
  }
205
 
206
  public Mail setTo(List<String> to) {
207
    this.to = to;
208
    return this;
209
  }
210
 
211
  public void unsetTo() {
212
    this.to = null;
213
  }
214
 
215
  /** Returns true if field to is set (has been asigned a value) and false otherwise */
216
  public boolean isSetTo() {
217
    return this.to != null;
218
  }
219
 
220
  public void setToIsSet(boolean value) {
221
    if (!value) {
222
      this.to = null;
223
    }
224
  }
225
 
226
  public String getSubject() {
227
    return this.subject;
228
  }
229
 
230
  public Mail setSubject(String subject) {
231
    this.subject = subject;
232
    return this;
233
  }
234
 
235
  public void unsetSubject() {
236
    this.subject = null;
237
  }
238
 
239
  /** Returns true if field subject is set (has been asigned a value) and false otherwise */
240
  public boolean isSetSubject() {
241
    return this.subject != null;
242
  }
243
 
244
  public void setSubjectIsSet(boolean value) {
245
    if (!value) {
246
      this.subject = null;
247
    }
248
  }
249
 
250
  public String getData() {
251
    return this.data;
252
  }
253
 
254
  public Mail setData(String data) {
255
    this.data = data;
256
    return this;
257
  }
258
 
259
  public void unsetData() {
260
    this.data = null;
261
  }
262
 
263
  /** Returns true if field data is set (has been asigned a value) and false otherwise */
264
  public boolean isSetData() {
265
    return this.data != null;
266
  }
267
 
268
  public void setDataIsSet(boolean value) {
269
    if (!value) {
270
      this.data = null;
271
    }
272
  }
273
 
274
  public String getSender() {
275
    return this.sender;
276
  }
277
 
278
  public Mail setSender(String sender) {
279
    this.sender = sender;
280
    return this;
281
  }
282
 
283
  public void unsetSender() {
284
    this.sender = null;
285
  }
286
 
287
  /** Returns true if field sender is set (has been asigned a value) and false otherwise */
288
  public boolean isSetSender() {
289
    return this.sender != null;
290
  }
291
 
292
  public void setSenderIsSet(boolean value) {
293
    if (!value) {
294
      this.sender = null;
295
    }
296
  }
297
 
298
  public int getAttachmentsSize() {
299
    return (this.attachments == null) ? 0 : this.attachments.size();
300
  }
301
 
302
  public java.util.Iterator<String> getAttachmentsIterator() {
303
    return (this.attachments == null) ? null : this.attachments.iterator();
304
  }
305
 
306
  public void addToAttachments(String elem) {
307
    if (this.attachments == null) {
308
      this.attachments = new ArrayList<String>();
309
    }
310
    this.attachments.add(elem);
311
  }
312
 
313
  public List<String> getAttachments() {
314
    return this.attachments;
315
  }
316
 
317
  public Mail setAttachments(List<String> attachments) {
318
    this.attachments = attachments;
319
    return this;
320
  }
321
 
322
  public void unsetAttachments() {
323
    this.attachments = null;
324
  }
325
 
326
  /** Returns true if field attachments is set (has been asigned a value) and false otherwise */
327
  public boolean isSetAttachments() {
328
    return this.attachments != null;
329
  }
330
 
331
  public void setAttachmentsIsSet(boolean value) {
332
    if (!value) {
333
      this.attachments = null;
334
    }
335
  }
336
 
337
  public String getPassword() {
338
    return this.password;
339
  }
340
 
341
  public Mail setPassword(String password) {
342
    this.password = password;
343
    return this;
344
  }
345
 
346
  public void unsetPassword() {
347
    this.password = null;
348
  }
349
 
350
  /** Returns true if field password is set (has been asigned a value) and false otherwise */
351
  public boolean isSetPassword() {
352
    return this.password != null;
353
  }
354
 
355
  public void setPasswordIsSet(boolean value) {
356
    if (!value) {
357
      this.password = null;
358
    }
359
  }
360
 
361
  public void setFieldValue(_Fields field, Object value) {
362
    switch (field) {
363
    case TO:
364
      if (value == null) {
365
        unsetTo();
366
      } else {
367
        setTo((List<String>)value);
368
      }
369
      break;
370
 
371
    case SUBJECT:
372
      if (value == null) {
373
        unsetSubject();
374
      } else {
375
        setSubject((String)value);
376
      }
377
      break;
378
 
379
    case DATA:
380
      if (value == null) {
381
        unsetData();
382
      } else {
383
        setData((String)value);
384
      }
385
      break;
386
 
387
    case SENDER:
388
      if (value == null) {
389
        unsetSender();
390
      } else {
391
        setSender((String)value);
392
      }
393
      break;
394
 
395
    case ATTACHMENTS:
396
      if (value == null) {
397
        unsetAttachments();
398
      } else {
399
        setAttachments((List<String>)value);
400
      }
401
      break;
402
 
403
    case PASSWORD:
404
      if (value == null) {
405
        unsetPassword();
406
      } else {
407
        setPassword((String)value);
408
      }
409
      break;
410
 
411
    }
412
  }
413
 
414
  public void setFieldValue(int fieldID, Object value) {
415
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
416
  }
417
 
418
  public Object getFieldValue(_Fields field) {
419
    switch (field) {
420
    case TO:
421
      return getTo();
422
 
423
    case SUBJECT:
424
      return getSubject();
425
 
426
    case DATA:
427
      return getData();
428
 
429
    case SENDER:
430
      return getSender();
431
 
432
    case ATTACHMENTS:
433
      return getAttachments();
434
 
435
    case PASSWORD:
436
      return getPassword();
437
 
438
    }
439
    throw new IllegalStateException();
440
  }
441
 
442
  public Object getFieldValue(int fieldId) {
443
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
444
  }
445
 
446
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
447
  public boolean isSet(_Fields field) {
448
    switch (field) {
449
    case TO:
450
      return isSetTo();
451
    case SUBJECT:
452
      return isSetSubject();
453
    case DATA:
454
      return isSetData();
455
    case SENDER:
456
      return isSetSender();
457
    case ATTACHMENTS:
458
      return isSetAttachments();
459
    case PASSWORD:
460
      return isSetPassword();
461
    }
462
    throw new IllegalStateException();
463
  }
464
 
465
  public boolean isSet(int fieldID) {
466
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
467
  }
468
 
469
  @Override
470
  public boolean equals(Object that) {
471
    if (that == null)
472
      return false;
473
    if (that instanceof Mail)
474
      return this.equals((Mail)that);
475
    return false;
476
  }
477
 
478
  public boolean equals(Mail that) {
479
    if (that == null)
480
      return false;
481
 
482
    boolean this_present_to = true && this.isSetTo();
483
    boolean that_present_to = true && that.isSetTo();
484
    if (this_present_to || that_present_to) {
485
      if (!(this_present_to && that_present_to))
486
        return false;
487
      if (!this.to.equals(that.to))
488
        return false;
489
    }
490
 
491
    boolean this_present_subject = true && this.isSetSubject();
492
    boolean that_present_subject = true && that.isSetSubject();
493
    if (this_present_subject || that_present_subject) {
494
      if (!(this_present_subject && that_present_subject))
495
        return false;
496
      if (!this.subject.equals(that.subject))
497
        return false;
498
    }
499
 
500
    boolean this_present_data = true && this.isSetData();
501
    boolean that_present_data = true && that.isSetData();
502
    if (this_present_data || that_present_data) {
503
      if (!(this_present_data && that_present_data))
504
        return false;
505
      if (!this.data.equals(that.data))
506
        return false;
507
    }
508
 
509
    boolean this_present_sender = true && this.isSetSender();
510
    boolean that_present_sender = true && that.isSetSender();
511
    if (this_present_sender || that_present_sender) {
512
      if (!(this_present_sender && that_present_sender))
513
        return false;
514
      if (!this.sender.equals(that.sender))
515
        return false;
516
    }
517
 
518
    boolean this_present_attachments = true && this.isSetAttachments();
519
    boolean that_present_attachments = true && that.isSetAttachments();
520
    if (this_present_attachments || that_present_attachments) {
521
      if (!(this_present_attachments && that_present_attachments))
522
        return false;
523
      if (!this.attachments.equals(that.attachments))
524
        return false;
525
    }
526
 
527
    boolean this_present_password = true && this.isSetPassword();
528
    boolean that_present_password = true && that.isSetPassword();
529
    if (this_present_password || that_present_password) {
530
      if (!(this_present_password && that_present_password))
531
        return false;
532
      if (!this.password.equals(that.password))
533
        return false;
534
    }
535
 
536
    return true;
537
  }
538
 
539
  @Override
540
  public int hashCode() {
541
    return 0;
542
  }
543
 
544
  public int compareTo(Mail other) {
545
    if (!getClass().equals(other.getClass())) {
546
      return getClass().getName().compareTo(other.getClass().getName());
547
    }
548
 
549
    int lastComparison = 0;
550
    Mail typedOther = (Mail)other;
551
 
552
    lastComparison = Boolean.valueOf(isSetTo()).compareTo(isSetTo());
553
    if (lastComparison != 0) {
554
      return lastComparison;
555
    }
556
    lastComparison = TBaseHelper.compareTo(to, typedOther.to);
557
    if (lastComparison != 0) {
558
      return lastComparison;
559
    }
560
    lastComparison = Boolean.valueOf(isSetSubject()).compareTo(isSetSubject());
561
    if (lastComparison != 0) {
562
      return lastComparison;
563
    }
564
    lastComparison = TBaseHelper.compareTo(subject, typedOther.subject);
565
    if (lastComparison != 0) {
566
      return lastComparison;
567
    }
568
    lastComparison = Boolean.valueOf(isSetData()).compareTo(isSetData());
569
    if (lastComparison != 0) {
570
      return lastComparison;
571
    }
572
    lastComparison = TBaseHelper.compareTo(data, typedOther.data);
573
    if (lastComparison != 0) {
574
      return lastComparison;
575
    }
576
    lastComparison = Boolean.valueOf(isSetSender()).compareTo(isSetSender());
577
    if (lastComparison != 0) {
578
      return lastComparison;
579
    }
580
    lastComparison = TBaseHelper.compareTo(sender, typedOther.sender);
581
    if (lastComparison != 0) {
582
      return lastComparison;
583
    }
584
    lastComparison = Boolean.valueOf(isSetAttachments()).compareTo(isSetAttachments());
585
    if (lastComparison != 0) {
586
      return lastComparison;
587
    }
588
    lastComparison = TBaseHelper.compareTo(attachments, typedOther.attachments);
589
    if (lastComparison != 0) {
590
      return lastComparison;
591
    }
592
    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(isSetPassword());
593
    if (lastComparison != 0) {
594
      return lastComparison;
595
    }
596
    lastComparison = TBaseHelper.compareTo(password, typedOther.password);
597
    if (lastComparison != 0) {
598
      return lastComparison;
599
    }
600
    return 0;
601
  }
602
 
603
  public void read(TProtocol iprot) throws TException {
604
    TField field;
605
    iprot.readStructBegin();
606
    while (true)
607
    {
608
      field = iprot.readFieldBegin();
609
      if (field.type == TType.STOP) { 
610
        break;
611
      }
612
      _Fields fieldId = _Fields.findByThriftId(field.id);
613
      if (fieldId == null) {
614
        TProtocolUtil.skip(iprot, field.type);
615
      } else {
616
        switch (fieldId) {
617
          case TO:
618
            if (field.type == TType.LIST) {
619
              {
620
                TList _list0 = iprot.readListBegin();
621
                this.to = new ArrayList<String>(_list0.size);
622
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
623
                {
624
                  String _elem2;
625
                  _elem2 = iprot.readString();
626
                  this.to.add(_elem2);
627
                }
628
                iprot.readListEnd();
629
              }
630
            } else { 
631
              TProtocolUtil.skip(iprot, field.type);
632
            }
633
            break;
634
          case SUBJECT:
635
            if (field.type == TType.STRING) {
636
              this.subject = iprot.readString();
637
            } else { 
638
              TProtocolUtil.skip(iprot, field.type);
639
            }
640
            break;
641
          case DATA:
642
            if (field.type == TType.STRING) {
643
              this.data = iprot.readString();
644
            } else { 
645
              TProtocolUtil.skip(iprot, field.type);
646
            }
647
            break;
648
          case SENDER:
649
            if (field.type == TType.STRING) {
650
              this.sender = iprot.readString();
651
            } else { 
652
              TProtocolUtil.skip(iprot, field.type);
653
            }
654
            break;
655
          case ATTACHMENTS:
656
            if (field.type == TType.LIST) {
657
              {
658
                TList _list3 = iprot.readListBegin();
659
                this.attachments = new ArrayList<String>(_list3.size);
660
                for (int _i4 = 0; _i4 < _list3.size; ++_i4)
661
                {
662
                  String _elem5;
663
                  _elem5 = iprot.readString();
664
                  this.attachments.add(_elem5);
665
                }
666
                iprot.readListEnd();
667
              }
668
            } else { 
669
              TProtocolUtil.skip(iprot, field.type);
670
            }
671
            break;
672
          case PASSWORD:
673
            if (field.type == TType.STRING) {
674
              this.password = iprot.readString();
675
            } else { 
676
              TProtocolUtil.skip(iprot, field.type);
677
            }
678
            break;
679
        }
680
        iprot.readFieldEnd();
681
      }
682
    }
683
    iprot.readStructEnd();
684
    validate();
685
  }
686
 
687
  public void write(TProtocol oprot) throws TException {
688
    validate();
689
 
690
    oprot.writeStructBegin(STRUCT_DESC);
691
    if (this.to != null) {
692
      oprot.writeFieldBegin(TO_FIELD_DESC);
693
      {
694
        oprot.writeListBegin(new TList(TType.STRING, this.to.size()));
695
        for (String _iter6 : this.to)
696
        {
697
          oprot.writeString(_iter6);
698
        }
699
        oprot.writeListEnd();
700
      }
701
      oprot.writeFieldEnd();
702
    }
703
    if (this.subject != null) {
704
      oprot.writeFieldBegin(SUBJECT_FIELD_DESC);
705
      oprot.writeString(this.subject);
706
      oprot.writeFieldEnd();
707
    }
708
    if (this.data != null) {
709
      oprot.writeFieldBegin(DATA_FIELD_DESC);
710
      oprot.writeString(this.data);
711
      oprot.writeFieldEnd();
712
    }
713
    if (this.sender != null) {
714
      oprot.writeFieldBegin(SENDER_FIELD_DESC);
715
      oprot.writeString(this.sender);
716
      oprot.writeFieldEnd();
717
    }
718
    if (this.attachments != null) {
719
      oprot.writeFieldBegin(ATTACHMENTS_FIELD_DESC);
720
      {
721
        oprot.writeListBegin(new TList(TType.STRING, this.attachments.size()));
722
        for (String _iter7 : this.attachments)
723
        {
724
          oprot.writeString(_iter7);
725
        }
726
        oprot.writeListEnd();
727
      }
728
      oprot.writeFieldEnd();
729
    }
730
    if (this.password != null) {
731
      oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
732
      oprot.writeString(this.password);
733
      oprot.writeFieldEnd();
734
    }
735
    oprot.writeFieldStop();
736
    oprot.writeStructEnd();
737
  }
738
 
739
  @Override
740
  public String toString() {
741
    StringBuilder sb = new StringBuilder("Mail(");
742
    boolean first = true;
743
 
744
    sb.append("to:");
745
    if (this.to == null) {
746
      sb.append("null");
747
    } else {
748
      sb.append(this.to);
749
    }
750
    first = false;
751
    if (!first) sb.append(", ");
752
    sb.append("subject:");
753
    if (this.subject == null) {
754
      sb.append("null");
755
    } else {
756
      sb.append(this.subject);
757
    }
758
    first = false;
759
    if (!first) sb.append(", ");
760
    sb.append("data:");
761
    if (this.data == null) {
762
      sb.append("null");
763
    } else {
764
      sb.append(this.data);
765
    }
766
    first = false;
767
    if (!first) sb.append(", ");
768
    sb.append("sender:");
769
    if (this.sender == null) {
770
      sb.append("null");
771
    } else {
772
      sb.append(this.sender);
773
    }
774
    first = false;
775
    if (!first) sb.append(", ");
776
    sb.append("attachments:");
777
    if (this.attachments == null) {
778
      sb.append("null");
779
    } else {
780
      sb.append(this.attachments);
781
    }
782
    first = false;
783
    if (!first) sb.append(", ");
784
    sb.append("password:");
785
    if (this.password == null) {
786
      sb.append("null");
787
    } else {
788
      sb.append(this.password);
789
    }
790
    first = false;
791
    sb.append(")");
792
    return sb.toString();
793
  }
794
 
795
  public void validate() throws TException {
796
    // check for required fields
797
  }
798
 
799
}
800