com.xiaomi.infra.galaxy.emq.thrift.PeekMessageResponse 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 PeekMessageResponse implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("PeekMessageResponse");
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 MESSAGE_BODY_FIELD_DESC = new libthrift091.protocol.TField("messageBody", libthrift091.protocol.TType.STRING, (short)2);
private static final libthrift091.protocol.TField ATTRIBUTES_FIELD_DESC = new libthrift091.protocol.TField("attributes", libthrift091.protocol.TType.MAP, (short)3);
private static final libthrift091.protocol.TField MESSAGE_ATTRIBUTES_FIELD_DESC = new libthrift091.protocol.TField("messageAttributes", libthrift091.protocol.TType.MAP, (short)4);
private static final libthrift091.protocol.TField E_FIELD_DESC = new libthrift091.protocol.TField("e", libthrift091.protocol.TType.STRUCT, (short)5);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new PeekMessageResponseStandardSchemeFactory());
schemes.put(TupleScheme.class, new PeekMessageResponseTupleSchemeFactory());
}
/**
* MessageID for the peeked message;
*
*/
public String messageID; // required
/**
* Message body for the received message;
*
*/
public String messageBody; // optional
/**
* 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
/**
* Peek message exception, when failed
*
*/
public com.xiaomi.infra.galaxy.emq.thrift.GalaxyEmqServiceException e; // 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 peeked message;
*
*/
MESSAGE_ID((short)1, "messageID"),
/**
* Message body for the received message;
*
*/
MESSAGE_BODY((short)2, "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)3, "attributes"),
/**
* User-defined attributes attached to message
*
*/
MESSAGE_ATTRIBUTES((short)4, "messageAttributes"),
/**
* Peek message exception, when failed
*
*/
E((short)5, "e");
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: // MESSAGE_BODY
return MESSAGE_BODY;
case 3: // ATTRIBUTES
return ATTRIBUTES;
case 4: // MESSAGE_ATTRIBUTES
return MESSAGE_ATTRIBUTES;
case 5: // E
return E;
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.MESSAGE_BODY,_Fields.ATTRIBUTES,_Fields.MESSAGE_ATTRIBUTES,_Fields.E};
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.MESSAGE_BODY, new libthrift091.meta_data.FieldMetaData("messageBody", libthrift091.TFieldRequirementType.OPTIONAL,
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))));
tmpMap.put(_Fields.E, new libthrift091.meta_data.FieldMetaData("e", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(PeekMessageResponse.class, metaDataMap);
}
public PeekMessageResponse() {
}
public PeekMessageResponse(
String messageID)
{
this();
this.messageID = messageID;
}
/**
* Performs a deep copy on other.
*/
public PeekMessageResponse(PeekMessageResponse other) {
if (other.isSetMessageID()) {
this.messageID = other.messageID;
}
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;
}
if (other.isSetE()) {
this.e = new com.xiaomi.infra.galaxy.emq.thrift.GalaxyEmqServiceException(other.e);
}
}
public PeekMessageResponse deepCopy() {
return new PeekMessageResponse(this);
}
@Override
public void clear() {
this.messageID = null;
this.messageBody = null;
this.attributes = null;
this.messageAttributes = null;
this.e = null;
}
/**
* MessageID for the peeked message;
*
*/
public String getMessageID() {
return this.messageID;
}
/**
* MessageID for the peeked message;
*
*/
public PeekMessageResponse 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;
}
}
/**
* Message body for the received message;
*
*/
public String getMessageBody() {
return this.messageBody;
}
/**
* Message body for the received message;
*
*/
public PeekMessageResponse 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 PeekMessageResponse 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 PeekMessageResponse 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;
}
}
/**
* Peek message exception, when failed
*
*/
public com.xiaomi.infra.galaxy.emq.thrift.GalaxyEmqServiceException getE() {
return this.e;
}
/**
* Peek message exception, when failed
*
*/
public PeekMessageResponse setE(com.xiaomi.infra.galaxy.emq.thrift.GalaxyEmqServiceException e) {
this.e = e;
return this;
}
public void unsetE() {
this.e = null;
}
/** Returns true if field e is set (has been assigned a value) and false otherwise */
public boolean isSetE() {
return this.e != null;
}
public void setEIsSet(boolean value) {
if (!value) {
this.e = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MESSAGE_ID:
if (value == null) {
unsetMessageID();
} else {
setMessageID((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;
case E:
if (value == null) {
unsetE();
} else {
setE((com.xiaomi.infra.galaxy.emq.thrift.GalaxyEmqServiceException)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MESSAGE_ID:
return getMessageID();
case MESSAGE_BODY:
return getMessageBody();
case ATTRIBUTES:
return getAttributes();
case MESSAGE_ATTRIBUTES:
return getMessageAttributes();
case E:
return getE();
}
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 MESSAGE_BODY:
return isSetMessageBody();
case ATTRIBUTES:
return isSetAttributes();
case MESSAGE_ATTRIBUTES:
return isSetMessageAttributes();
case E:
return isSetE();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof PeekMessageResponse)
return this.equals((PeekMessageResponse)that);
return false;
}
public boolean equals(PeekMessageResponse 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_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;
}
boolean this_present_e = true && this.isSetE();
boolean that_present_e = true && that.isSetE();
if (this_present_e || that_present_e) {
if (!(this_present_e && that_present_e))
return false;
if (!this.e.equals(that.e))
return false;
}
return true;
}
@Override
public int hashCode() {
List