Rev 420 | Blame | Last modification | View Log | RSS feed
/*** Autogenerated by Thrift** DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING*/package in.shop2020.payments;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.util.Arrays;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.apache.thrift.*;import org.apache.thrift.meta_data.*;import org.apache.thrift.protocol.*;public class PaymentRequest implements TBase<PaymentRequest._Fields>, java.io.Serializable, Cloneable, Comparable<PaymentRequest> {private static final TStruct STRUCT_DESC = new TStruct("PaymentRequest");private static final TField REQUEST_ID_FIELD_DESC = new TField("request_id", TType.I64, (short)1);private static final TField APPLICATION_ID_FIELD_DESC = new TField("application_id", TType.I64, (short)2);private static final TField REQUEST_STATUS_FIELD_DESC = new TField("requestStatus", TType.I32, (short)3);private static final TField RECEIVING_TIMESTAMP_FIELD_DESC = new TField("receiving_timestamp", TType.I64, (short)4);private static final TField SENDING_TIMESTAMP_FIELD_DESC = new TField("sending_timestamp", TType.I64, (short)5);private static final TField PARAMS_FIELD_DESC = new TField("params", TType.LIST, (short)6);private static final TField MERCHANT_TX_ID_FIELD_DESC = new TField("merchant_tx_id", TType.I64, (short)7);private long request_id;private long application_id;private RequestStatus requestStatus;private long receiving_timestamp;private long sending_timestamp;private List<Param> params;private long merchant_tx_id;/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */public enum _Fields implements TFieldIdEnum {REQUEST_ID((short)1, "request_id"),APPLICATION_ID((short)2, "application_id"),/**** @see RequestStatus*/REQUEST_STATUS((short)3, "requestStatus"),RECEIVING_TIMESTAMP((short)4, "receiving_timestamp"),SENDING_TIMESTAMP((short)5, "sending_timestamp"),PARAMS((short)6, "params"),MERCHANT_TX_ID((short)7, "merchant_tx_id");private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byId.put((int)field._thriftId, field);byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {return byId.get(fieldId);}/*** 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 assignmentsprivate static final int __REQUEST_ID_ISSET_ID = 0;private static final int __APPLICATION_ID_ISSET_ID = 1;private static final int __RECEIVING_TIMESTAMP_ISSET_ID = 2;private static final int __SENDING_TIMESTAMP_ISSET_ID = 3;private static final int __MERCHANT_TX_ID_ISSET_ID = 4;private BitSet __isset_bit_vector = new BitSet(5);public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{put(_Fields.REQUEST_ID, new FieldMetaData("request_id", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.I64)));put(_Fields.APPLICATION_ID, new FieldMetaData("application_id", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.I64)));put(_Fields.REQUEST_STATUS, new FieldMetaData("requestStatus", TFieldRequirementType.DEFAULT,new EnumMetaData(TType.ENUM, RequestStatus.class)));put(_Fields.RECEIVING_TIMESTAMP, new FieldMetaData("receiving_timestamp", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.I64)));put(_Fields.SENDING_TIMESTAMP, new FieldMetaData("sending_timestamp", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.I64)));put(_Fields.PARAMS, new FieldMetaData("params", TFieldRequirementType.DEFAULT,new ListMetaData(TType.LIST,new StructMetaData(TType.STRUCT, Param.class))));put(_Fields.MERCHANT_TX_ID, new FieldMetaData("merchant_tx_id", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.I64)));}});static {FieldMetaData.addStructMetaDataMap(PaymentRequest.class, metaDataMap);}public PaymentRequest() {}public PaymentRequest(long request_id,long application_id,RequestStatus requestStatus,long receiving_timestamp,long sending_timestamp,List<Param> params,long merchant_tx_id){this();this.request_id = request_id;setRequest_idIsSet(true);this.application_id = application_id;setApplication_idIsSet(true);this.requestStatus = requestStatus;this.receiving_timestamp = receiving_timestamp;setReceiving_timestampIsSet(true);this.sending_timestamp = sending_timestamp;setSending_timestampIsSet(true);this.params = params;this.merchant_tx_id = merchant_tx_id;setMerchant_tx_idIsSet(true);}/*** Performs a deep copy on <i>other</i>.*/public PaymentRequest(PaymentRequest other) {__isset_bit_vector.clear();__isset_bit_vector.or(other.__isset_bit_vector);this.request_id = other.request_id;this.application_id = other.application_id;if (other.isSetRequestStatus()) {this.requestStatus = other.requestStatus;}this.receiving_timestamp = other.receiving_timestamp;this.sending_timestamp = other.sending_timestamp;if (other.isSetParams()) {List<Param> __this__params = new ArrayList<Param>();for (Param other_element : other.params) {__this__params.add(new Param(other_element));}this.params = __this__params;}this.merchant_tx_id = other.merchant_tx_id;}public PaymentRequest deepCopy() {return new PaymentRequest(this);}@Deprecatedpublic PaymentRequest clone() {return new PaymentRequest(this);}public long getRequest_id() {return this.request_id;}public PaymentRequest setRequest_id(long request_id) {this.request_id = request_id;setRequest_idIsSet(true);return this;}public void unsetRequest_id() {__isset_bit_vector.clear(__REQUEST_ID_ISSET_ID);}/** Returns true if field request_id is set (has been asigned a value) and false otherwise */public boolean isSetRequest_id() {return __isset_bit_vector.get(__REQUEST_ID_ISSET_ID);}public void setRequest_idIsSet(boolean value) {__isset_bit_vector.set(__REQUEST_ID_ISSET_ID, value);}public long getApplication_id() {return this.application_id;}public PaymentRequest setApplication_id(long application_id) {this.application_id = application_id;setApplication_idIsSet(true);return this;}public void unsetApplication_id() {__isset_bit_vector.clear(__APPLICATION_ID_ISSET_ID);}/** Returns true if field application_id is set (has been asigned a value) and false otherwise */public boolean isSetApplication_id() {return __isset_bit_vector.get(__APPLICATION_ID_ISSET_ID);}public void setApplication_idIsSet(boolean value) {__isset_bit_vector.set(__APPLICATION_ID_ISSET_ID, value);}/**** @see RequestStatus*/public RequestStatus getRequestStatus() {return this.requestStatus;}/**** @see RequestStatus*/public PaymentRequest setRequestStatus(RequestStatus requestStatus) {this.requestStatus = requestStatus;return this;}public void unsetRequestStatus() {this.requestStatus = null;}/** Returns true if field requestStatus is set (has been asigned a value) and false otherwise */public boolean isSetRequestStatus() {return this.requestStatus != null;}public void setRequestStatusIsSet(boolean value) {if (!value) {this.requestStatus = null;}}public long getReceiving_timestamp() {return this.receiving_timestamp;}public PaymentRequest setReceiving_timestamp(long receiving_timestamp) {this.receiving_timestamp = receiving_timestamp;setReceiving_timestampIsSet(true);return this;}public void unsetReceiving_timestamp() {__isset_bit_vector.clear(__RECEIVING_TIMESTAMP_ISSET_ID);}/** Returns true if field receiving_timestamp is set (has been asigned a value) and false otherwise */public boolean isSetReceiving_timestamp() {return __isset_bit_vector.get(__RECEIVING_TIMESTAMP_ISSET_ID);}public void setReceiving_timestampIsSet(boolean value) {__isset_bit_vector.set(__RECEIVING_TIMESTAMP_ISSET_ID, value);}public long getSending_timestamp() {return this.sending_timestamp;}public PaymentRequest setSending_timestamp(long sending_timestamp) {this.sending_timestamp = sending_timestamp;setSending_timestampIsSet(true);return this;}public void unsetSending_timestamp() {__isset_bit_vector.clear(__SENDING_TIMESTAMP_ISSET_ID);}/** Returns true if field sending_timestamp is set (has been asigned a value) and false otherwise */public boolean isSetSending_timestamp() {return __isset_bit_vector.get(__SENDING_TIMESTAMP_ISSET_ID);}public void setSending_timestampIsSet(boolean value) {__isset_bit_vector.set(__SENDING_TIMESTAMP_ISSET_ID, value);}public int getParamsSize() {return (this.params == null) ? 0 : this.params.size();}public java.util.Iterator<Param> getParamsIterator() {return (this.params == null) ? null : this.params.iterator();}public void addToParams(Param elem) {if (this.params == null) {this.params = new ArrayList<Param>();}this.params.add(elem);}public List<Param> getParams() {return this.params;}public PaymentRequest setParams(List<Param> params) {this.params = params;return this;}public void unsetParams() {this.params = null;}/** Returns true if field params is set (has been asigned a value) and false otherwise */public boolean isSetParams() {return this.params != null;}public void setParamsIsSet(boolean value) {if (!value) {this.params = null;}}public long getMerchant_tx_id() {return this.merchant_tx_id;}public PaymentRequest setMerchant_tx_id(long merchant_tx_id) {this.merchant_tx_id = merchant_tx_id;setMerchant_tx_idIsSet(true);return this;}public void unsetMerchant_tx_id() {__isset_bit_vector.clear(__MERCHANT_TX_ID_ISSET_ID);}/** Returns true if field merchant_tx_id is set (has been asigned a value) and false otherwise */public boolean isSetMerchant_tx_id() {return __isset_bit_vector.get(__MERCHANT_TX_ID_ISSET_ID);}public void setMerchant_tx_idIsSet(boolean value) {__isset_bit_vector.set(__MERCHANT_TX_ID_ISSET_ID, value);}public void setFieldValue(_Fields field, Object value) {switch (field) {case REQUEST_ID:if (value == null) {unsetRequest_id();} else {setRequest_id((Long)value);}break;case APPLICATION_ID:if (value == null) {unsetApplication_id();} else {setApplication_id((Long)value);}break;case REQUEST_STATUS:if (value == null) {unsetRequestStatus();} else {setRequestStatus((RequestStatus)value);}break;case RECEIVING_TIMESTAMP:if (value == null) {unsetReceiving_timestamp();} else {setReceiving_timestamp((Long)value);}break;case SENDING_TIMESTAMP:if (value == null) {unsetSending_timestamp();} else {setSending_timestamp((Long)value);}break;case PARAMS:if (value == null) {unsetParams();} else {setParams((List<Param>)value);}break;case MERCHANT_TX_ID:if (value == null) {unsetMerchant_tx_id();} else {setMerchant_tx_id((Long)value);}break;}}public void setFieldValue(int fieldID, Object value) {setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);}public Object getFieldValue(_Fields field) {switch (field) {case REQUEST_ID:return new Long(getRequest_id());case APPLICATION_ID:return new Long(getApplication_id());case REQUEST_STATUS:return getRequestStatus();case RECEIVING_TIMESTAMP:return new Long(getReceiving_timestamp());case SENDING_TIMESTAMP:return new Long(getSending_timestamp());case PARAMS:return getParams();case MERCHANT_TX_ID:return new Long(getMerchant_tx_id());}throw new IllegalStateException();}public Object getFieldValue(int fieldId) {return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));}/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */public boolean isSet(_Fields field) {switch (field) {case REQUEST_ID:return isSetRequest_id();case APPLICATION_ID:return isSetApplication_id();case REQUEST_STATUS:return isSetRequestStatus();case RECEIVING_TIMESTAMP:return isSetReceiving_timestamp();case SENDING_TIMESTAMP:return isSetSending_timestamp();case PARAMS:return isSetParams();case MERCHANT_TX_ID:return isSetMerchant_tx_id();}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof PaymentRequest)return this.equals((PaymentRequest)that);return false;}public boolean equals(PaymentRequest that) {if (that == null)return false;boolean this_present_request_id = true;boolean that_present_request_id = true;if (this_present_request_id || that_present_request_id) {if (!(this_present_request_id && that_present_request_id))return false;if (this.request_id != that.request_id)return false;}boolean this_present_application_id = true;boolean that_present_application_id = true;if (this_present_application_id || that_present_application_id) {if (!(this_present_application_id && that_present_application_id))return false;if (this.application_id != that.application_id)return false;}boolean this_present_requestStatus = true && this.isSetRequestStatus();boolean that_present_requestStatus = true && that.isSetRequestStatus();if (this_present_requestStatus || that_present_requestStatus) {if (!(this_present_requestStatus && that_present_requestStatus))return false;if (!this.requestStatus.equals(that.requestStatus))return false;}boolean this_present_receiving_timestamp = true;boolean that_present_receiving_timestamp = true;if (this_present_receiving_timestamp || that_present_receiving_timestamp) {if (!(this_present_receiving_timestamp && that_present_receiving_timestamp))return false;if (this.receiving_timestamp != that.receiving_timestamp)return false;}boolean this_present_sending_timestamp = true;boolean that_present_sending_timestamp = true;if (this_present_sending_timestamp || that_present_sending_timestamp) {if (!(this_present_sending_timestamp && that_present_sending_timestamp))return false;if (this.sending_timestamp != that.sending_timestamp)return false;}boolean this_present_params = true && this.isSetParams();boolean that_present_params = true && that.isSetParams();if (this_present_params || that_present_params) {if (!(this_present_params && that_present_params))return false;if (!this.params.equals(that.params))return false;}boolean this_present_merchant_tx_id = true;boolean that_present_merchant_tx_id = true;if (this_present_merchant_tx_id || that_present_merchant_tx_id) {if (!(this_present_merchant_tx_id && that_present_merchant_tx_id))return false;if (this.merchant_tx_id != that.merchant_tx_id)return false;}return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(PaymentRequest other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;PaymentRequest typedOther = (PaymentRequest)other;lastComparison = Boolean.valueOf(isSetRequest_id()).compareTo(isSetRequest_id());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(request_id, typedOther.request_id);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetApplication_id()).compareTo(isSetApplication_id());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(application_id, typedOther.application_id);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetRequestStatus()).compareTo(isSetRequestStatus());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(requestStatus, typedOther.requestStatus);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetReceiving_timestamp()).compareTo(isSetReceiving_timestamp());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(receiving_timestamp, typedOther.receiving_timestamp);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetSending_timestamp()).compareTo(isSetSending_timestamp());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(sending_timestamp, typedOther.sending_timestamp);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetParams()).compareTo(isSetParams());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(params, typedOther.params);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetMerchant_tx_id()).compareTo(isSetMerchant_tx_id());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(merchant_tx_id, typedOther.merchant_tx_id);if (lastComparison != 0) {return lastComparison;}return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {case REQUEST_ID:if (field.type == TType.I64) {this.request_id = iprot.readI64();setRequest_idIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case APPLICATION_ID:if (field.type == TType.I64) {this.application_id = iprot.readI64();setApplication_idIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case REQUEST_STATUS:if (field.type == TType.I32) {this.requestStatus = RequestStatus.findByValue(iprot.readI32());} else {TProtocolUtil.skip(iprot, field.type);}break;case RECEIVING_TIMESTAMP:if (field.type == TType.I64) {this.receiving_timestamp = iprot.readI64();setReceiving_timestampIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case SENDING_TIMESTAMP:if (field.type == TType.I64) {this.sending_timestamp = iprot.readI64();setSending_timestampIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case PARAMS:if (field.type == TType.LIST) {{TList _list10 = iprot.readListBegin();this.params = new ArrayList<Param>(_list10.size);for (int _i11 = 0; _i11 < _list10.size; ++_i11){Param _elem12;_elem12 = new Param();_elem12.read(iprot);this.params.add(_elem12);}iprot.readListEnd();}} else {TProtocolUtil.skip(iprot, field.type);}break;case MERCHANT_TX_ID:if (field.type == TType.I64) {this.merchant_tx_id = iprot.readI64();setMerchant_tx_idIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;}iprot.readFieldEnd();}}iprot.readStructEnd();validate();}public void write(TProtocol oprot) throws TException {validate();oprot.writeStructBegin(STRUCT_DESC);oprot.writeFieldBegin(REQUEST_ID_FIELD_DESC);oprot.writeI64(this.request_id);oprot.writeFieldEnd();oprot.writeFieldBegin(APPLICATION_ID_FIELD_DESC);oprot.writeI64(this.application_id);oprot.writeFieldEnd();if (this.requestStatus != null) {oprot.writeFieldBegin(REQUEST_STATUS_FIELD_DESC);oprot.writeI32(this.requestStatus.getValue());oprot.writeFieldEnd();}oprot.writeFieldBegin(RECEIVING_TIMESTAMP_FIELD_DESC);oprot.writeI64(this.receiving_timestamp);oprot.writeFieldEnd();oprot.writeFieldBegin(SENDING_TIMESTAMP_FIELD_DESC);oprot.writeI64(this.sending_timestamp);oprot.writeFieldEnd();if (this.params != null) {oprot.writeFieldBegin(PARAMS_FIELD_DESC);{oprot.writeListBegin(new TList(TType.STRUCT, this.params.size()));for (Param _iter13 : this.params){_iter13.write(oprot);}oprot.writeListEnd();}oprot.writeFieldEnd();}oprot.writeFieldBegin(MERCHANT_TX_ID_FIELD_DESC);oprot.writeI64(this.merchant_tx_id);oprot.writeFieldEnd();oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("PaymentRequest(");boolean first = true;sb.append("request_id:");sb.append(this.request_id);first = false;if (!first) sb.append(", ");sb.append("application_id:");sb.append(this.application_id);first = false;if (!first) sb.append(", ");sb.append("requestStatus:");if (this.requestStatus == null) {sb.append("null");} else {String requestStatus_name = requestStatus.name();if (requestStatus_name != null) {sb.append(requestStatus_name);sb.append(" (");}sb.append(this.requestStatus);if (requestStatus_name != null) {sb.append(")");}}first = false;if (!first) sb.append(", ");sb.append("receiving_timestamp:");sb.append(this.receiving_timestamp);first = false;if (!first) sb.append(", ");sb.append("sending_timestamp:");sb.append(this.sending_timestamp);first = false;if (!first) sb.append(", ");sb.append("params:");if (this.params == null) {sb.append("null");} else {sb.append(this.params);}first = false;if (!first) sb.append(", ");sb.append("merchant_tx_id:");sb.append(this.merchant_tx_id);first = false;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}