/** * 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 ThriftUnicastNotificationMessage implements org.apache.thrift.TBase<ThriftUnicastNotificationMessage, ThriftUnicastNotificationMessage._Fields>, java.io.Serializable, Cloneable, Comparable<ThriftUnicastNotificationMessage> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftUnicastNotificationMessage"); private static final org.apache.thrift.protocol.TField ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("address", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final org.apache.thrift.protocol.TField ACTOR_CLASSIFIER_FIELD_DESC = new org.apache.thrift.protocol.TField("actorClassifier", org.apache.thrift.protocol.TType.I32, (short)2); private static final org.apache.thrift.protocol.TField NOTIFICATION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("notificationId", org.apache.thrift.protocol.TType.STRING, (short)3); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new ThriftUnicastNotificationMessageStandardSchemeFactory()); schemes.put(TupleScheme.class, new ThriftUnicastNotificationMessageTupleSchemeFactory()); } public ThriftEntityAddress address; // required /** * * @see ThriftActorClassifier */ public ThriftActorClassifier actorClassifier; // required public String notificationId; // 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 { ADDRESS((short)1, "address"), /** * * @see ThriftActorClassifier */ ACTOR_CLASSIFIER((short)2, "actorClassifier"), NOTIFICATION_ID((short)3, "notificationId"); 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: // ADDRESS return ADDRESS; case 2: // ACTOR_CLASSIFIER return ACTOR_CLASSIFIER; case 3: // NOTIFICATION_ID return NOTIFICATION_ID; 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 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.ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("address", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftEntityAddress.class))); tmpMap.put(_Fields.ACTOR_CLASSIFIER, new org.apache.thrift.meta_data.FieldMetaData("actorClassifier", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ThriftActorClassifier.class))); tmpMap.put(_Fields.NOTIFICATION_ID, new org.apache.thrift.meta_data.FieldMetaData("notificationId", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftUnicastNotificationMessage.class, metaDataMap); } public ThriftUnicastNotificationMessage() { } public ThriftUnicastNotificationMessage( ThriftEntityAddress address, ThriftActorClassifier actorClassifier, String notificationId) { this(); this.address = address; this.actorClassifier = actorClassifier; this.notificationId = notificationId; } /** * Performs a deep copy on <i>other</i>. */ public ThriftUnicastNotificationMessage(ThriftUnicastNotificationMessage other) { if (other.isSetAddress()) { this.address = new ThriftEntityAddress(other.address); } if (other.isSetActorClassifier()) { this.actorClassifier = other.actorClassifier; } if (other.isSetNotificationId()) { this.notificationId = other.notificationId; } } public ThriftUnicastNotificationMessage deepCopy() { return new ThriftUnicastNotificationMessage(this); } @Override public void clear() { this.address = null; this.actorClassifier = null; this.notificationId = null; } public ThriftEntityAddress getAddress() { return this.address; } public ThriftUnicastNotificationMessage setAddress(ThriftEntityAddress address) { this.address = address; return this; } public void unsetAddress() { this.address = null; } /** Returns true if field address is set (has been assigned a value) and false otherwise */ public boolean isSetAddress() { return this.address != null; } public void setAddressIsSet(boolean value) { if (!value) { this.address = null; } } /** * * @see ThriftActorClassifier */ public ThriftActorClassifier getActorClassifier() { return this.actorClassifier; } /** * * @see ThriftActorClassifier */ public ThriftUnicastNotificationMessage setActorClassifier(ThriftActorClassifier actorClassifier) { this.actorClassifier = actorClassifier; return this; } public void unsetActorClassifier() { this.actorClassifier = null; } /** Returns true if field actorClassifier is set (has been assigned a value) and false otherwise */ public boolean isSetActorClassifier() { return this.actorClassifier != null; } public void setActorClassifierIsSet(boolean value) { if (!value) { this.actorClassifier = null; } } public String getNotificationId() { return this.notificationId; } public ThriftUnicastNotificationMessage setNotificationId(String notificationId) { this.notificationId = notificationId; return this; } public void unsetNotificationId() { this.notificationId = null; } /** Returns true if field notificationId is set (has been assigned a value) and false otherwise */ public boolean isSetNotificationId() { return this.notificationId != null; } public void setNotificationIdIsSet(boolean value) { if (!value) { this.notificationId = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case ADDRESS: if (value == null) { unsetAddress(); } else { setAddress((ThriftEntityAddress)value); } break; case ACTOR_CLASSIFIER: if (value == null) { unsetActorClassifier(); } else { setActorClassifier((ThriftActorClassifier)value); } break; case NOTIFICATION_ID: if (value == null) { unsetNotificationId(); } else { setNotificationId((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case ADDRESS: return getAddress(); case ACTOR_CLASSIFIER: return getActorClassifier(); case NOTIFICATION_ID: return getNotificationId(); } 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 ADDRESS: return isSetAddress(); case ACTOR_CLASSIFIER: return isSetActorClassifier(); case NOTIFICATION_ID: return isSetNotificationId(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof ThriftUnicastNotificationMessage) return this.equals((ThriftUnicastNotificationMessage)that); return false; } public boolean equals(ThriftUnicastNotificationMessage that) { if (that == null) return false; boolean this_present_address = true && this.isSetAddress(); boolean that_present_address = true && that.isSetAddress(); if (this_present_address || that_present_address) { if (!(this_present_address && that_present_address)) return false; if (!this.address.equals(that.address)) return false; } boolean this_present_actorClassifier = true && this.isSetActorClassifier(); boolean that_present_actorClassifier = true && that.isSetActorClassifier(); if (this_present_actorClassifier || that_present_actorClassifier) { if (!(this_present_actorClassifier && that_present_actorClassifier)) return false; if (!this.actorClassifier.equals(that.actorClassifier)) return false; } boolean this_present_notificationId = true && this.isSetNotificationId(); boolean that_present_notificationId = true && that.isSetNotificationId(); if (this_present_notificationId || that_present_notificationId) { if (!(this_present_notificationId && that_present_notificationId)) return false; if (!this.notificationId.equals(that.notificationId)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_address = true && (isSetAddress()); list.add(present_address); if (present_address) list.add(address); boolean present_actorClassifier = true && (isSetActorClassifier()); list.add(present_actorClassifier); if (present_actorClassifier) list.add(actorClassifier.getValue()); boolean present_notificationId = true && (isSetNotificationId()); list.add(present_notificationId); if (present_notificationId) list.add(notificationId); return list.hashCode(); } @Override public int compareTo(ThriftUnicastNotificationMessage other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetAddress()).compareTo(other.isSetAddress()); if (lastComparison != 0) { return lastComparison; } if (isSetAddress()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.address, other.address); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetActorClassifier()).compareTo(other.isSetActorClassifier()); if (lastComparison != 0) { return lastComparison; } if (isSetActorClassifier()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.actorClassifier, other.actorClassifier); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetNotificationId()).compareTo(other.isSetNotificationId()); if (lastComparison != 0) { return lastComparison; } if (isSetNotificationId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notificationId, other.notificationId); 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("ThriftUnicastNotificationMessage("); boolean first = true; sb.append("address:"); if (this.address == null) { sb.append("null"); } else { sb.append(this.address); } first = false; if (!first) sb.append(", "); sb.append("actorClassifier:"); if (this.actorClassifier == null) { sb.append("null"); } else { sb.append(this.actorClassifier); } first = false; if (!first) sb.append(", "); sb.append("notificationId:"); if (this.notificationId == null) { sb.append("null"); } else { sb.append(this.notificationId); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity if (address != null) { address.validate(); } } 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 { 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 ThriftUnicastNotificationMessageStandardSchemeFactory implements SchemeFactory { public ThriftUnicastNotificationMessageStandardScheme getScheme() { return new ThriftUnicastNotificationMessageStandardScheme(); } } private static class ThriftUnicastNotificationMessageStandardScheme extends StandardScheme<ThriftUnicastNotificationMessage> { public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftUnicastNotificationMessage 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: // ADDRESS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.address = new ThriftEntityAddress(); struct.address.read(iprot); struct.setAddressIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // ACTOR_CLASSIFIER if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.actorClassifier = org.kaaproject.kaa.server.common.thrift.gen.operations.ThriftActorClassifier.findByValue(iprot.readI32()); struct.setActorClassifierIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // NOTIFICATION_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.notificationId = iprot.readString(); struct.setNotificationIdIsSet(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, ThriftUnicastNotificationMessage struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.address != null) { oprot.writeFieldBegin(ADDRESS_FIELD_DESC); struct.address.write(oprot); oprot.writeFieldEnd(); } if (struct.actorClassifier != null) { oprot.writeFieldBegin(ACTOR_CLASSIFIER_FIELD_DESC); oprot.writeI32(struct.actorClassifier.getValue()); oprot.writeFieldEnd(); } if (struct.notificationId != null) { oprot.writeFieldBegin(NOTIFICATION_ID_FIELD_DESC); oprot.writeString(struct.notificationId); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class ThriftUnicastNotificationMessageTupleSchemeFactory implements SchemeFactory { public ThriftUnicastNotificationMessageTupleScheme getScheme() { return new ThriftUnicastNotificationMessageTupleScheme(); } } private static class ThriftUnicastNotificationMessageTupleScheme extends TupleScheme<ThriftUnicastNotificationMessage> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, ThriftUnicastNotificationMessage struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetAddress()) { optionals.set(0); } if (struct.isSetActorClassifier()) { optionals.set(1); } if (struct.isSetNotificationId()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetAddress()) { struct.address.write(oprot); } if (struct.isSetActorClassifier()) { oprot.writeI32(struct.actorClassifier.getValue()); } if (struct.isSetNotificationId()) { oprot.writeString(struct.notificationId); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, ThriftUnicastNotificationMessage struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.address = new ThriftEntityAddress(); struct.address.read(iprot); struct.setAddressIsSet(true); } if (incoming.get(1)) { struct.actorClassifier = org.kaaproject.kaa.server.common.thrift.gen.operations.ThriftActorClassifier.findByValue(iprot.readI32()); struct.setActorClassifierIsSet(true); } if (incoming.get(2)) { struct.notificationId = iprot.readString(); struct.setNotificationIdIsSet(true); } } } }