com.xiaomi.infra.galaxy.emq.thrift.ReceiveMessageResponse Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.emq.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.server.AbstractNonblockingServer.*;
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 javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-9-13")
public class ReceiveMessageResponse implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("ReceiveMessageResponse");
private static final libthrift091.protocol.TField MESSAGE_ID_FIELD_DESC = new libthrift091.protocol.TField("messageID", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField RECEIPT_HANDLE_FIELD_DESC = new libthrift091.protocol.TField("receiptHandle", libthrift091.protocol.TType.STRING, (short)2);
private static final libthrift091.protocol.TField MESSAGE_BODY_FIELD_DESC = new libthrift091.protocol.TField("messageBody", libthrift091.protocol.TType.STRING, (short)3);
private static final libthrift091.protocol.TField ATTRIBUTES_FIELD_DESC = new libthrift091.protocol.TField("attributes", libthrift091.protocol.TType.MAP, (short)4);
private static final libthrift091.protocol.TField MESSAGE_ATTRIBUTES_FIELD_DESC = new libthrift091.protocol.TField("messageAttributes", libthrift091.protocol.TType.MAP, (short)5);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ReceiveMessageResponseStandardSchemeFactory());
schemes.put(TupleScheme.class, new ReceiveMessageResponseTupleSchemeFactory());
}
/**
* MessageID for the received message;
*
*/
public String messageID; // required
/**
* Receipt Handle for the received message
* Using when change visibility time/delete message
*
*/
public String receiptHandle; // required
/**
* Message body for the received message;
*
*/
public String messageBody; // required
/**
* Attributes of message, including:
* - senderId
* - priority
* - messageLength
* - md5OfBody
* - sendTimestamp
* - receiveTimestamp
* - firstReceiveTimestamp
* - receiveCount
*
* If the message is received from a dead letter queue,
* it has another four attributes:
* - sourceQueueName
* - sourceTag
* - deadTimestamp
* - originalMessageID
* - originalReceiveCount
*
* If the message has been set topic
* - topic
*
*/
public Map attributes; // optional
/**
* User-defined attributes attached to message
*
*/
public Map messageAttributes; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
/**
* MessageID for the received message;
*
*/
MESSAGE_ID((short)1, "messageID"),
/**
* Receipt Handle for the received message
* Using when change visibility time/delete message
*
*/
RECEIPT_HANDLE((short)2, "receiptHandle"),
/**
* Message body for the received message;
*
*/
MESSAGE_BODY((short)3, "messageBody"),
/**
* Attributes of message, including:
* - senderId
* - priority
* - messageLength
* - md5OfBody
* - sendTimestamp
* - receiveTimestamp
* - firstReceiveTimestamp
* - receiveCount
*
* If the message is received from a dead letter queue,
* it has another four attributes:
* - sourceQueueName
* - sourceTag
* - deadTimestamp
* - originalMessageID
* - originalReceiveCount
*
* If the message has been set topic
* - topic
*
*/
ATTRIBUTES((short)4, "attributes"),
/**
* User-defined attributes attached to message
*
*/
MESSAGE_ATTRIBUTES((short)5, "messageAttributes");
private static final Map byName = new HashMap();
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: // MESSAGE_ID
return MESSAGE_ID;
case 2: // RECEIPT_HANDLE
return RECEIPT_HANDLE;
case 3: // MESSAGE_BODY
return MESSAGE_BODY;
case 4: // ATTRIBUTES
return ATTRIBUTES;
case 5: // MESSAGE_ATTRIBUTES
return MESSAGE_ATTRIBUTES;
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 _Fields optionals[] = {_Fields.ATTRIBUTES,_Fields.MESSAGE_ATTRIBUTES};
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.MESSAGE_ID, new libthrift091.meta_data.FieldMetaData("messageID", libthrift091.TFieldRequirementType.REQUIRED,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.RECEIPT_HANDLE, new libthrift091.meta_data.FieldMetaData("receiptHandle", libthrift091.TFieldRequirementType.REQUIRED,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.MESSAGE_BODY, new libthrift091.meta_data.FieldMetaData("messageBody", libthrift091.TFieldRequirementType.REQUIRED,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.ATTRIBUTES, new libthrift091.meta_data.FieldMetaData("attributes", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.MapMetaData(libthrift091.protocol.TType.MAP,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING),
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING))));
tmpMap.put(_Fields.MESSAGE_ATTRIBUTES, new libthrift091.meta_data.FieldMetaData("messageAttributes", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.MapMetaData(libthrift091.protocol.TType.MAP,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING),
new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, MessageAttribute.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(ReceiveMessageResponse.class, metaDataMap);
}
public ReceiveMessageResponse() {
}
public ReceiveMessageResponse(
String messageID,
String receiptHandle,
String messageBody)
{
this();
this.messageID = messageID;
this.receiptHandle = receiptHandle;
this.messageBody = messageBody;
}
/**
* Performs a deep copy on other.
*/
public ReceiveMessageResponse(ReceiveMessageResponse other) {
if (other.isSetMessageID()) {
this.messageID = other.messageID;
}
if (other.isSetReceiptHandle()) {
this.receiptHandle = other.receiptHandle;
}
if (other.isSetMessageBody()) {
this.messageBody = other.messageBody;
}
if (other.isSetAttributes()) {
Map __this__attributes = new HashMap(other.attributes);
this.attributes = __this__attributes;
}
if (other.isSetMessageAttributes()) {
Map __this__messageAttributes = new HashMap(other.messageAttributes.size());
for (Map.Entry other_element : other.messageAttributes.entrySet()) {
String other_element_key = other_element.getKey();
MessageAttribute other_element_value = other_element.getValue();
String __this__messageAttributes_copy_key = other_element_key;
MessageAttribute __this__messageAttributes_copy_value = new MessageAttribute(other_element_value);
__this__messageAttributes.put(__this__messageAttributes_copy_key, __this__messageAttributes_copy_value);
}
this.messageAttributes = __this__messageAttributes;
}
}
public ReceiveMessageResponse deepCopy() {
return new ReceiveMessageResponse(this);
}
@Override
public void clear() {
this.messageID = null;
this.receiptHandle = null;
this.messageBody = null;
this.attributes = null;
this.messageAttributes = null;
}
/**
* MessageID for the received message;
*
*/
public String getMessageID() {
return this.messageID;
}
/**
* MessageID for the received message;
*
*/
public ReceiveMessageResponse setMessageID(String messageID) {
this.messageID = messageID;
return this;
}
public void unsetMessageID() {
this.messageID = null;
}
/** Returns true if field messageID is set (has been assigned a value) and false otherwise */
public boolean isSetMessageID() {
return this.messageID != null;
}
public void setMessageIDIsSet(boolean value) {
if (!value) {
this.messageID = null;
}
}
/**
* Receipt Handle for the received message
* Using when change visibility time/delete message
*
*/
public String getReceiptHandle() {
return this.receiptHandle;
}
/**
* Receipt Handle for the received message
* Using when change visibility time/delete message
*
*/
public ReceiveMessageResponse setReceiptHandle(String receiptHandle) {
this.receiptHandle = receiptHandle;
return this;
}
public void unsetReceiptHandle() {
this.receiptHandle = null;
}
/** Returns true if field receiptHandle is set (has been assigned a value) and false otherwise */
public boolean isSetReceiptHandle() {
return this.receiptHandle != null;
}
public void setReceiptHandleIsSet(boolean value) {
if (!value) {
this.receiptHandle = null;
}
}
/**
* Message body for the received message;
*
*/
public String getMessageBody() {
return this.messageBody;
}
/**
* Message body for the received message;
*
*/
public ReceiveMessageResponse setMessageBody(String messageBody) {
this.messageBody = messageBody;
return this;
}
public void unsetMessageBody() {
this.messageBody = null;
}
/** Returns true if field messageBody is set (has been assigned a value) and false otherwise */
public boolean isSetMessageBody() {
return this.messageBody != null;
}
public void setMessageBodyIsSet(boolean value) {
if (!value) {
this.messageBody = null;
}
}
public int getAttributesSize() {
return (this.attributes == null) ? 0 : this.attributes.size();
}
public void putToAttributes(String key, String val) {
if (this.attributes == null) {
this.attributes = new HashMap();
}
this.attributes.put(key, val);
}
/**
* Attributes of message, including:
* - senderId
* - priority
* - messageLength
* - md5OfBody
* - sendTimestamp
* - receiveTimestamp
* - firstReceiveTimestamp
* - receiveCount
*
* If the message is received from a dead letter queue,
* it has another four attributes:
* - sourceQueueName
* - sourceTag
* - deadTimestamp
* - originalMessageID
* - originalReceiveCount
*
* If the message has been set topic
* - topic
*
*/
public Map getAttributes() {
return this.attributes;
}
/**
* Attributes of message, including:
* - senderId
* - priority
* - messageLength
* - md5OfBody
* - sendTimestamp
* - receiveTimestamp
* - firstReceiveTimestamp
* - receiveCount
*
* If the message is received from a dead letter queue,
* it has another four attributes:
* - sourceQueueName
* - sourceTag
* - deadTimestamp
* - originalMessageID
* - originalReceiveCount
*
* If the message has been set topic
* - topic
*
*/
public ReceiveMessageResponse setAttributes(Map attributes) {
this.attributes = attributes;
return this;
}
public void unsetAttributes() {
this.attributes = null;
}
/** Returns true if field attributes is set (has been assigned a value) and false otherwise */
public boolean isSetAttributes() {
return this.attributes != null;
}
public void setAttributesIsSet(boolean value) {
if (!value) {
this.attributes = null;
}
}
public int getMessageAttributesSize() {
return (this.messageAttributes == null) ? 0 : this.messageAttributes.size();
}
public void putToMessageAttributes(String key, MessageAttribute val) {
if (this.messageAttributes == null) {
this.messageAttributes = new HashMap();
}
this.messageAttributes.put(key, val);
}
/**
* User-defined attributes attached to message
*
*/
public Map getMessageAttributes() {
return this.messageAttributes;
}
/**
* User-defined attributes attached to message
*
*/
public ReceiveMessageResponse setMessageAttributes(Map messageAttributes) {
this.messageAttributes = messageAttributes;
return this;
}
public void unsetMessageAttributes() {
this.messageAttributes = null;
}
/** Returns true if field messageAttributes is set (has been assigned a value) and false otherwise */
public boolean isSetMessageAttributes() {
return this.messageAttributes != null;
}
public void setMessageAttributesIsSet(boolean value) {
if (!value) {
this.messageAttributes = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MESSAGE_ID:
if (value == null) {
unsetMessageID();
} else {
setMessageID((String)value);
}
break;
case RECEIPT_HANDLE:
if (value == null) {
unsetReceiptHandle();
} else {
setReceiptHandle((String)value);
}
break;
case MESSAGE_BODY:
if (value == null) {
unsetMessageBody();
} else {
setMessageBody((String)value);
}
break;
case ATTRIBUTES:
if (value == null) {
unsetAttributes();
} else {
setAttributes((Map)value);
}
break;
case MESSAGE_ATTRIBUTES:
if (value == null) {
unsetMessageAttributes();
} else {
setMessageAttributes((Map)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MESSAGE_ID:
return getMessageID();
case RECEIPT_HANDLE:
return getReceiptHandle();
case MESSAGE_BODY:
return getMessageBody();
case ATTRIBUTES:
return getAttributes();
case MESSAGE_ATTRIBUTES:
return getMessageAttributes();
}
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 MESSAGE_ID:
return isSetMessageID();
case RECEIPT_HANDLE:
return isSetReceiptHandle();
case MESSAGE_BODY:
return isSetMessageBody();
case ATTRIBUTES:
return isSetAttributes();
case MESSAGE_ATTRIBUTES:
return isSetMessageAttributes();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ReceiveMessageResponse)
return this.equals((ReceiveMessageResponse)that);
return false;
}
public boolean equals(ReceiveMessageResponse that) {
if (that == null)
return false;
boolean this_present_messageID = true && this.isSetMessageID();
boolean that_present_messageID = true && that.isSetMessageID();
if (this_present_messageID || that_present_messageID) {
if (!(this_present_messageID && that_present_messageID))
return false;
if (!this.messageID.equals(that.messageID))
return false;
}
boolean this_present_receiptHandle = true && this.isSetReceiptHandle();
boolean that_present_receiptHandle = true && that.isSetReceiptHandle();
if (this_present_receiptHandle || that_present_receiptHandle) {
if (!(this_present_receiptHandle && that_present_receiptHandle))
return false;
if (!this.receiptHandle.equals(that.receiptHandle))
return false;
}
boolean this_present_messageBody = true && this.isSetMessageBody();
boolean that_present_messageBody = true && that.isSetMessageBody();
if (this_present_messageBody || that_present_messageBody) {
if (!(this_present_messageBody && that_present_messageBody))
return false;
if (!this.messageBody.equals(that.messageBody))
return false;
}
boolean this_present_attributes = true && this.isSetAttributes();
boolean that_present_attributes = true && that.isSetAttributes();
if (this_present_attributes || that_present_attributes) {
if (!(this_present_attributes && that_present_attributes))
return false;
if (!this.attributes.equals(that.attributes))
return false;
}
boolean this_present_messageAttributes = true && this.isSetMessageAttributes();
boolean that_present_messageAttributes = true && that.isSetMessageAttributes();
if (this_present_messageAttributes || that_present_messageAttributes) {
if (!(this_present_messageAttributes && that_present_messageAttributes))
return false;
if (!this.messageAttributes.equals(that.messageAttributes))
return false;
}
return true;
}
@Override
public int hashCode() {
List