/** * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.kaaproject.kaa.server.common.thrift.gen.operations; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import org.apache.thrift.async.AsyncMethodCallback; import org.apache.thrift.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.3)", date = "2016-11-14") public class EndpointEvent implements org.apache.thrift.TBase<EndpointEvent, EndpointEvent._Fields>, java.io.Serializable, Cloneable, Comparable<EndpointEvent> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("EndpointEvent"); private static final org.apache.thrift.protocol.TField UUID_FIELD_DESC = new org.apache.thrift.protocol.TField("uuid", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField SENDER_FIELD_DESC = new org.apache.thrift.protocol.TField("sender", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField EVENT_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("eventData", org.apache.thrift.protocol.TType.STRING, (short)3); private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I64, (short)4); private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I32, (short)5); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new EndpointEventStandardSchemeFactory()); schemes.put(TupleScheme.class, new EndpointEventTupleSchemeFactory()); } public String uuid; // required public ByteBuffer sender; // required public ByteBuffer eventData; // required public long createTime; // required public int version; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { UUID((short)1, "uuid"), SENDER((short)2, "sender"), EVENT_DATA((short)3, "eventData"), CREATE_TIME((short)4, "createTime"), VERSION((short)5, "version"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); 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: // UUID return UUID; case 2: // SENDER return SENDER; case 3: // EVENT_DATA return EVENT_DATA; case 4: // CREATE_TIME return CREATE_TIME; case 5: // VERSION return VERSION; 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 int __CREATETIME_ISSET_ID = 0; private static final int __VERSION_ISSET_ID = 1; private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.UUID, new org.apache.thrift.meta_data.FieldMetaData("uuid", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.SENDER, new org.apache.thrift.meta_data.FieldMetaData("sender", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "endpoint_id"))); tmpMap.put(_Fields.EVENT_DATA, new org.apache.thrift.meta_data.FieldMetaData("eventData", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "Long"))); tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "Integer"))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(EndpointEvent.class, metaDataMap); } public EndpointEvent() { } public EndpointEvent( String uuid, ByteBuffer sender, ByteBuffer eventData, long createTime, int version) { this(); this.uuid = uuid; this.sender = org.apache.thrift.TBaseHelper.copyBinary(sender); this.eventData = org.apache.thrift.TBaseHelper.copyBinary(eventData); this.createTime = createTime; setCreateTimeIsSet(true); this.version = version; setVersionIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public EndpointEvent(EndpointEvent other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetUuid()) { this.uuid = other.uuid; } if (other.isSetSender()) { this.sender = other.sender; } if (other.isSetEventData()) { this.eventData = org.apache.thrift.TBaseHelper.copyBinary(other.eventData); } this.createTime = other.createTime; this.version = other.version; } public EndpointEvent deepCopy() { return new EndpointEvent(this); } @Override public void clear() { this.uuid = null; this.sender = null; this.eventData = null; setCreateTimeIsSet(false); this.createTime = 0; setVersionIsSet(false); this.version = 0; } public String getUuid() { return this.uuid; } public EndpointEvent setUuid(String uuid) { this.uuid = uuid; return this; } public void unsetUuid() { this.uuid = null; } /** Returns true if field uuid is set (has been assigned a value) and false otherwise */ public boolean isSetUuid() { return this.uuid != null; } public void setUuidIsSet(boolean value) { if (!value) { this.uuid = null; } } public byte[] getSender() { setSender(org.apache.thrift.TBaseHelper.rightSize(sender)); return sender == null ? null : sender.array(); } public ByteBuffer bufferForSender() { return org.apache.thrift.TBaseHelper.copyBinary(sender); } public EndpointEvent setSender(byte[] sender) { this.sender = sender == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(sender, sender.length)); return this; } public EndpointEvent setSender(ByteBuffer sender) { this.sender = org.apache.thrift.TBaseHelper.copyBinary(sender); return this; } public void unsetSender() { this.sender = null; } /** Returns true if field sender is set (has been assigned a value) and false otherwise */ public boolean isSetSender() { return this.sender != null; } public void setSenderIsSet(boolean value) { if (!value) { this.sender = null; } } public byte[] getEventData() { setEventData(org.apache.thrift.TBaseHelper.rightSize(eventData)); return eventData == null ? null : eventData.array(); } public ByteBuffer bufferForEventData() { return org.apache.thrift.TBaseHelper.copyBinary(eventData); } public EndpointEvent setEventData(byte[] eventData) { this.eventData = eventData == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(eventData, eventData.length)); return this; } public EndpointEvent setEventData(ByteBuffer eventData) { this.eventData = org.apache.thrift.TBaseHelper.copyBinary(eventData); return this; } public void unsetEventData() { this.eventData = null; } /** Returns true if field eventData is set (has been assigned a value) and false otherwise */ public boolean isSetEventData() { return this.eventData != null; } public void setEventDataIsSet(boolean value) { if (!value) { this.eventData = null; } } public long getCreateTime() { return this.createTime; } public EndpointEvent setCreateTime(long createTime) { this.createTime = createTime; setCreateTimeIsSet(true); return this; } public void unsetCreateTime() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID); } /** Returns true if field createTime is set (has been assigned a value) and false otherwise */ public boolean isSetCreateTime() { return EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID); } public void setCreateTimeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value); } public int getVersion() { return this.version; } public EndpointEvent setVersion(int version) { this.version = version; setVersionIsSet(true); return this; } public void unsetVersion() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID); } /** Returns true if field version is set (has been assigned a value) and false otherwise */ public boolean isSetVersion() { return EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID); } public void setVersionIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case UUID: if (value == null) { unsetUuid(); } else { setUuid((String)value); } break; case SENDER: if (value == null) { unsetSender(); } else { setSender((ByteBuffer)value); } break; case EVENT_DATA: if (value == null) { unsetEventData(); } else { setEventData((ByteBuffer)value); } break; case CREATE_TIME: if (value == null) { unsetCreateTime(); } else { setCreateTime((Long)value); } break; case VERSION: if (value == null) { unsetVersion(); } else { setVersion((Integer)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case UUID: return getUuid(); case SENDER: return getSender(); case EVENT_DATA: return getEventData(); case CREATE_TIME: return getCreateTime(); case VERSION: return getVersion(); } 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 UUID: return isSetUuid(); case SENDER: return isSetSender(); case EVENT_DATA: return isSetEventData(); case CREATE_TIME: return isSetCreateTime(); case VERSION: return isSetVersion(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof EndpointEvent) return this.equals((EndpointEvent)that); return false; } public boolean equals(EndpointEvent that) { if (that == null) return false; boolean this_present_uuid = true && this.isSetUuid(); boolean that_present_uuid = true && that.isSetUuid(); if (this_present_uuid || that_present_uuid) { if (!(this_present_uuid && that_present_uuid)) return false; if (!this.uuid.equals(that.uuid)) return false; } boolean this_present_sender = true && this.isSetSender(); boolean that_present_sender = true && that.isSetSender(); if (this_present_sender || that_present_sender) { if (!(this_present_sender && that_present_sender)) return false; if (!this.sender.equals(that.sender)) return false; } boolean this_present_eventData = true && this.isSetEventData(); boolean that_present_eventData = true && that.isSetEventData(); if (this_present_eventData || that_present_eventData) { if (!(this_present_eventData && that_present_eventData)) return false; if (!this.eventData.equals(that.eventData)) return false; } boolean this_present_createTime = true; boolean that_present_createTime = true; if (this_present_createTime || that_present_createTime) { if (!(this_present_createTime && that_present_createTime)) return false; if (this.createTime != that.createTime) return false; } boolean this_present_version = true; boolean that_present_version = true; if (this_present_version || that_present_version) { if (!(this_present_version && that_present_version)) return false; if (this.version != that.version) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_uuid = true && (isSetUuid()); list.add(present_uuid); if (present_uuid) list.add(uuid); boolean present_sender = true && (isSetSender()); list.add(present_sender); if (present_sender) list.add(sender); boolean present_eventData = true && (isSetEventData()); list.add(present_eventData); if (present_eventData) list.add(eventData); boolean present_createTime = true; list.add(present_createTime); if (present_createTime) list.add(createTime); boolean present_version = true; list.add(present_version); if (present_version) list.add(version); return list.hashCode(); } @Override public int compareTo(EndpointEvent other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetUuid()).compareTo(other.isSetUuid()); if (lastComparison != 0) { return lastComparison; } if (isSetUuid()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uuid, other.uuid); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSender()).compareTo(other.isSetSender()); if (lastComparison != 0) { return lastComparison; } if (isSetSender()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sender, other.sender); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetEventData()).compareTo(other.isSetEventData()); if (lastComparison != 0) { return lastComparison; } if (isSetEventData()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventData, other.eventData); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(other.isSetCreateTime()); if (lastComparison != 0) { return lastComparison; } if (isSetCreateTime()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, other.createTime); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion()); if (lastComparison != 0) { return lastComparison; } if (isSetVersion()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("EndpointEvent("); boolean first = true; sb.append("uuid:"); if (this.uuid == null) { sb.append("null"); } else { sb.append(this.uuid); } first = false; if (!first) sb.append(", "); sb.append("sender:"); if (this.sender == null) { sb.append("null"); } else { org.apache.thrift.TBaseHelper.toString(this.sender, sb); } first = false; if (!first) sb.append(", "); sb.append("eventData:"); if (this.eventData == null) { sb.append("null"); } else { org.apache.thrift.TBaseHelper.toString(this.eventData, sb); } first = false; if (!first) sb.append(", "); sb.append("createTime:"); sb.append(this.createTime); first = false; if (!first) sb.append(", "); sb.append("version:"); sb.append(this.version); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class EndpointEventStandardSchemeFactory implements SchemeFactory { public EndpointEventStandardScheme getScheme() { return new EndpointEventStandardScheme(); } } private static class EndpointEventStandardScheme extends StandardScheme<EndpointEvent> { public void read(org.apache.thrift.protocol.TProtocol iprot, EndpointEvent struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // UUID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.uuid = iprot.readString(); struct.setUuidIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // SENDER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.sender = iprot.readBinary(); struct.setSenderIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // EVENT_DATA if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.eventData = iprot.readBinary(); struct.setEventDataIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // CREATE_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.createTime = iprot.readI64(); struct.setCreateTimeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // VERSION if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.version = iprot.readI32(); struct.setVersionIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, EndpointEvent struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.uuid != null) { oprot.writeFieldBegin(UUID_FIELD_DESC); oprot.writeString(struct.uuid); oprot.writeFieldEnd(); } if (struct.sender != null) { oprot.writeFieldBegin(SENDER_FIELD_DESC); oprot.writeBinary(struct.sender); oprot.writeFieldEnd(); } if (struct.eventData != null) { oprot.writeFieldBegin(EVENT_DATA_FIELD_DESC); oprot.writeBinary(struct.eventData); oprot.writeFieldEnd(); } oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC); oprot.writeI64(struct.createTime); oprot.writeFieldEnd(); oprot.writeFieldBegin(VERSION_FIELD_DESC); oprot.writeI32(struct.version); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class EndpointEventTupleSchemeFactory implements SchemeFactory { public EndpointEventTupleScheme getScheme() { return new EndpointEventTupleScheme(); } } private static class EndpointEventTupleScheme extends TupleScheme<EndpointEvent> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, EndpointEvent struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetUuid()) { optionals.set(0); } if (struct.isSetSender()) { optionals.set(1); } if (struct.isSetEventData()) { optionals.set(2); } if (struct.isSetCreateTime()) { optionals.set(3); } if (struct.isSetVersion()) { optionals.set(4); } oprot.writeBitSet(optionals, 5); if (struct.isSetUuid()) { oprot.writeString(struct.uuid); } if (struct.isSetSender()) { oprot.writeBinary(struct.sender); } if (struct.isSetEventData()) { oprot.writeBinary(struct.eventData); } if (struct.isSetCreateTime()) { oprot.writeI64(struct.createTime); } if (struct.isSetVersion()) { oprot.writeI32(struct.version); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, EndpointEvent struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.uuid = iprot.readString(); struct.setUuidIsSet(true); } if (incoming.get(1)) { struct.sender = iprot.readBinary(); struct.setSenderIsSet(true); } if (incoming.get(2)) { struct.eventData = iprot.readBinary(); struct.setEventDataIsSet(true); } if (incoming.get(3)) { struct.createTime = iprot.readI64(); struct.setCreateTimeIsSet(true); } if (incoming.get(4)) { struct.version = iprot.readI32(); struct.setVersionIsSet(true); } } } }