Subversion Repositories SmartDukaan

Rev

Rev 5504 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5504 Rev 5512
Line 21... Line 21...
21
import org.slf4j.LoggerFactory;
21
import org.slf4j.LoggerFactory;
22
 
22
 
23
public class VoucherItemMapping implements org.apache.thrift.TBase<VoucherItemMapping, VoucherItemMapping._Fields>, java.io.Serializable, Cloneable {
23
public class VoucherItemMapping implements org.apache.thrift.TBase<VoucherItemMapping, VoucherItemMapping._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("VoucherItemMapping");
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("VoucherItemMapping");
25
 
25
 
26
  private static final org.apache.thrift.protocol.TField VOUCHER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("voucherType", org.apache.thrift.protocol.TType.STRING, (short)1);
26
  private static final org.apache.thrift.protocol.TField VOUCHER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("voucherType", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I64, (short)2);
27
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)3);
28
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)3);
29
 
29
 
30
  private String voucherType; // required
30
  private long voucherType; // required
31
  private long itemId; // required
31
  private long itemId; // required
32
  private long amount; // required
32
  private long amount; // required
33
 
33
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
Line 94... Line 94...
94
      return _fieldName;
94
      return _fieldName;
95
    }
95
    }
96
  }
96
  }
97
 
97
 
98
  // isset id assignments
98
  // isset id assignments
-
 
99
  private static final int __VOUCHERTYPE_ISSET_ID = 0;
99
  private static final int __ITEMID_ISSET_ID = 0;
100
  private static final int __ITEMID_ISSET_ID = 1;
100
  private static final int __AMOUNT_ISSET_ID = 1;
101
  private static final int __AMOUNT_ISSET_ID = 2;
101
  private BitSet __isset_bit_vector = new BitSet(2);
102
  private BitSet __isset_bit_vector = new BitSet(3);
102
 
103
 
103
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
104
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
104
  static {
105
  static {
105
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
106
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
106
    tmpMap.put(_Fields.VOUCHER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("voucherType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
107
    tmpMap.put(_Fields.VOUCHER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("voucherType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
107
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
108
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
109
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
109
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
110
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
110
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
111
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
111
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
112
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
112
    metaDataMap = Collections.unmodifiableMap(tmpMap);
113
    metaDataMap = Collections.unmodifiableMap(tmpMap);
Line 115... Line 116...
115
 
116
 
116
  public VoucherItemMapping() {
117
  public VoucherItemMapping() {
117
  }
118
  }
118
 
119
 
119
  public VoucherItemMapping(
120
  public VoucherItemMapping(
120
    String voucherType,
121
    long voucherType,
121
    long itemId,
122
    long itemId,
122
    long amount)
123
    long amount)
123
  {
124
  {
124
    this();
125
    this();
125
    this.voucherType = voucherType;
126
    this.voucherType = voucherType;
-
 
127
    setVoucherTypeIsSet(true);
126
    this.itemId = itemId;
128
    this.itemId = itemId;
127
    setItemIdIsSet(true);
129
    setItemIdIsSet(true);
128
    this.amount = amount;
130
    this.amount = amount;
129
    setAmountIsSet(true);
131
    setAmountIsSet(true);
130
  }
132
  }
Line 133... Line 135...
133
   * Performs a deep copy on <i>other</i>.
135
   * Performs a deep copy on <i>other</i>.
134
   */
136
   */
135
  public VoucherItemMapping(VoucherItemMapping other) {
137
  public VoucherItemMapping(VoucherItemMapping other) {
136
    __isset_bit_vector.clear();
138
    __isset_bit_vector.clear();
137
    __isset_bit_vector.or(other.__isset_bit_vector);
139
    __isset_bit_vector.or(other.__isset_bit_vector);
138
    if (other.isSetVoucherType()) {
-
 
139
      this.voucherType = other.voucherType;
140
    this.voucherType = other.voucherType;
140
    }
-
 
141
    this.itemId = other.itemId;
141
    this.itemId = other.itemId;
142
    this.amount = other.amount;
142
    this.amount = other.amount;
143
  }
143
  }
144
 
144
 
145
  public VoucherItemMapping deepCopy() {
145
  public VoucherItemMapping deepCopy() {
146
    return new VoucherItemMapping(this);
146
    return new VoucherItemMapping(this);
147
  }
147
  }
148
 
148
 
149
  @Override
149
  @Override
150
  public void clear() {
150
  public void clear() {
-
 
151
    setVoucherTypeIsSet(false);
151
    this.voucherType = null;
152
    this.voucherType = 0;
152
    setItemIdIsSet(false);
153
    setItemIdIsSet(false);
153
    this.itemId = 0;
154
    this.itemId = 0;
154
    setAmountIsSet(false);
155
    setAmountIsSet(false);
155
    this.amount = 0;
156
    this.amount = 0;
156
  }
157
  }
157
 
158
 
158
  public String getVoucherType() {
159
  public long getVoucherType() {
159
    return this.voucherType;
160
    return this.voucherType;
160
  }
161
  }
161
 
162
 
162
  public void setVoucherType(String voucherType) {
163
  public void setVoucherType(long voucherType) {
163
    this.voucherType = voucherType;
164
    this.voucherType = voucherType;
-
 
165
    setVoucherTypeIsSet(true);
164
  }
166
  }
165
 
167
 
166
  public void unsetVoucherType() {
168
  public void unsetVoucherType() {
167
    this.voucherType = null;
169
    __isset_bit_vector.clear(__VOUCHERTYPE_ISSET_ID);
168
  }
170
  }
169
 
171
 
170
  /** Returns true if field voucherType is set (has been assigned a value) and false otherwise */
172
  /** Returns true if field voucherType is set (has been assigned a value) and false otherwise */
171
  public boolean isSetVoucherType() {
173
  public boolean isSetVoucherType() {
172
    return this.voucherType != null;
174
    return __isset_bit_vector.get(__VOUCHERTYPE_ISSET_ID);
173
  }
175
  }
174
 
176
 
175
  public void setVoucherTypeIsSet(boolean value) {
177
  public void setVoucherTypeIsSet(boolean value) {
176
    if (!value) {
-
 
177
      this.voucherType = null;
178
    __isset_bit_vector.set(__VOUCHERTYPE_ISSET_ID, value);
178
    }
-
 
179
  }
179
  }
180
 
180
 
181
  public long getItemId() {
181
  public long getItemId() {
182
    return this.itemId;
182
    return this.itemId;
183
  }
183
  }
Line 226... Line 226...
226
    switch (field) {
226
    switch (field) {
227
    case VOUCHER_TYPE:
227
    case VOUCHER_TYPE:
228
      if (value == null) {
228
      if (value == null) {
229
        unsetVoucherType();
229
        unsetVoucherType();
230
      } else {
230
      } else {
231
        setVoucherType((String)value);
231
        setVoucherType((Long)value);
232
      }
232
      }
233
      break;
233
      break;
234
 
234
 
235
    case ITEM_ID:
235
    case ITEM_ID:
236
      if (value == null) {
236
      if (value == null) {
Line 252... Line 252...
252
  }
252
  }
253
 
253
 
254
  public Object getFieldValue(_Fields field) {
254
  public Object getFieldValue(_Fields field) {
255
    switch (field) {
255
    switch (field) {
256
    case VOUCHER_TYPE:
256
    case VOUCHER_TYPE:
257
      return getVoucherType();
257
      return Long.valueOf(getVoucherType());
258
 
258
 
259
    case ITEM_ID:
259
    case ITEM_ID:
260
      return Long.valueOf(getItemId());
260
      return Long.valueOf(getItemId());
261
 
261
 
262
    case AMOUNT:
262
    case AMOUNT:
Line 294... Line 294...
294
 
294
 
295
  public boolean equals(VoucherItemMapping that) {
295
  public boolean equals(VoucherItemMapping that) {
296
    if (that == null)
296
    if (that == null)
297
      return false;
297
      return false;
298
 
298
 
299
    boolean this_present_voucherType = true && this.isSetVoucherType();
299
    boolean this_present_voucherType = true;
300
    boolean that_present_voucherType = true && that.isSetVoucherType();
300
    boolean that_present_voucherType = true;
301
    if (this_present_voucherType || that_present_voucherType) {
301
    if (this_present_voucherType || that_present_voucherType) {
302
      if (!(this_present_voucherType && that_present_voucherType))
302
      if (!(this_present_voucherType && that_present_voucherType))
303
        return false;
303
        return false;
304
      if (!this.voucherType.equals(that.voucherType))
304
      if (this.voucherType != that.voucherType)
305
        return false;
305
        return false;
306
    }
306
    }
307
 
307
 
308
    boolean this_present_itemId = true;
308
    boolean this_present_itemId = true;
309
    boolean that_present_itemId = true;
309
    boolean that_present_itemId = true;
Line 385... Line 385...
385
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
385
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
386
        break;
386
        break;
387
      }
387
      }
388
      switch (field.id) {
388
      switch (field.id) {
389
        case 1: // VOUCHER_TYPE
389
        case 1: // VOUCHER_TYPE
390
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
390
          if (field.type == org.apache.thrift.protocol.TType.I64) {
391
            this.voucherType = iprot.readString();
391
            this.voucherType = iprot.readI64();
-
 
392
            setVoucherTypeIsSet(true);
392
          } else { 
393
          } else { 
393
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
394
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
394
          }
395
          }
395
          break;
396
          break;
396
        case 2: // ITEM_ID
397
        case 2: // ITEM_ID
Line 420... Line 421...
420
 
421
 
421
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
422
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
422
    validate();
423
    validate();
423
 
424
 
424
    oprot.writeStructBegin(STRUCT_DESC);
425
    oprot.writeStructBegin(STRUCT_DESC);
425
    if (this.voucherType != null) {
-
 
426
      oprot.writeFieldBegin(VOUCHER_TYPE_FIELD_DESC);
426
    oprot.writeFieldBegin(VOUCHER_TYPE_FIELD_DESC);
427
      oprot.writeString(this.voucherType);
427
    oprot.writeI64(this.voucherType);
428
      oprot.writeFieldEnd();
428
    oprot.writeFieldEnd();
429
    }
-
 
430
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
429
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
431
    oprot.writeI64(this.itemId);
430
    oprot.writeI64(this.itemId);
432
    oprot.writeFieldEnd();
431
    oprot.writeFieldEnd();
433
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
432
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
434
    oprot.writeI64(this.amount);
433
    oprot.writeI64(this.amount);
Line 441... Line 440...
441
  public String toString() {
440
  public String toString() {
442
    StringBuilder sb = new StringBuilder("VoucherItemMapping(");
441
    StringBuilder sb = new StringBuilder("VoucherItemMapping(");
443
    boolean first = true;
442
    boolean first = true;
444
 
443
 
445
    sb.append("voucherType:");
444
    sb.append("voucherType:");
446
    if (this.voucherType == null) {
-
 
447
      sb.append("null");
-
 
448
    } else {
-
 
449
      sb.append(this.voucherType);
445
    sb.append(this.voucherType);
450
    }
-
 
451
    first = false;
446
    first = false;
452
    if (!first) sb.append(", ");
447
    if (!first) sb.append(", ");
453
    sb.append("itemId:");
448
    sb.append("itemId:");
454
    sb.append(this.itemId);
449
    sb.append(this.itemId);
455
    first = false;
450
    first = false;