/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package org.pyload.thrift; 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 org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.thrift.*; import org.apache.thrift.async.*; import org.apache.thrift.meta_data.*; import org.apache.thrift.transport.*; import org.apache.thrift.protocol.*; public class Event implements TBase<Event, Event._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("Event"); private static final TField EVENT_FIELD_DESC = new TField("event", TType.STRING, (short)1); private static final TField ID_FIELD_DESC = new TField("id", TType.I32, (short)2); private static final TField TYPE_FIELD_DESC = new TField("type", TType.I32, (short)3); private static final TField DESTINATION_FIELD_DESC = new TField("destination", TType.I32, (short)4); public String event; public int id; /** * * @see ElementType */ public ElementType type; /** * * @see Destination */ public Destination destination; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { EVENT((short)1, "event"), ID((short)2, "id"), /** * * @see ElementType */ TYPE((short)3, "type"), /** * * @see Destination */ DESTINATION((short)4, "destination"); 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: // EVENT return EVENT; case 2: // ID return ID; case 3: // TYPE return TYPE; case 4: // DESTINATION return DESTINATION; 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 __ID_ISSET_ID = 0; private BitSet __isset_bit_vector = new BitSet(1); public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.EVENT, new FieldMetaData("event", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMap.put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.OPTIONAL, new FieldValueMetaData(TType.I32))); tmpMap.put(_Fields.TYPE, new FieldMetaData("type", TFieldRequirementType.OPTIONAL, new EnumMetaData(TType.ENUM, ElementType.class))); tmpMap.put(_Fields.DESTINATION, new FieldMetaData("destination", TFieldRequirementType.OPTIONAL, new EnumMetaData(TType.ENUM, Destination.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(Event.class, metaDataMap); } public Event() { } public Event( String event) { this(); this.event = event; } /** * Performs a deep copy on <i>other</i>. */ public Event(Event other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); if (other.isSetEvent()) { this.event = other.event; } this.id = other.id; if (other.isSetType()) { this.type = other.type; } if (other.isSetDestination()) { this.destination = other.destination; } } public Event deepCopy() { return new Event(this); } @Override public void clear() { this.event = null; setIdIsSet(false); this.id = 0; this.type = null; this.destination = null; } public String getEvent() { return this.event; } public Event setEvent(String event) { this.event = event; return this; } public void unsetEvent() { this.event = null; } /** Returns true if field event is set (has been asigned a value) and false otherwise */ public boolean isSetEvent() { return this.event != null; } public void setEventIsSet(boolean value) { if (!value) { this.event = null; } } public int getId() { return this.id; } public Event setId(int id) { this.id = id; setIdIsSet(true); return this; } public void unsetId() { __isset_bit_vector.clear(__ID_ISSET_ID); } /** Returns true if field id is set (has been asigned a value) and false otherwise */ public boolean isSetId() { return __isset_bit_vector.get(__ID_ISSET_ID); } public void setIdIsSet(boolean value) { __isset_bit_vector.set(__ID_ISSET_ID, value); } /** * * @see ElementType */ public ElementType getType() { return this.type; } /** * * @see ElementType */ public Event setType(ElementType type) { this.type = type; return this; } public void unsetType() { this.type = null; } /** Returns true if field type is set (has been asigned a value) and false otherwise */ public boolean isSetType() { return this.type != null; } public void setTypeIsSet(boolean value) { if (!value) { this.type = null; } } /** * * @see Destination */ public Destination getDestination() { return this.destination; } /** * * @see Destination */ public Event setDestination(Destination destination) { this.destination = destination; return this; } public void unsetDestination() { this.destination = null; } /** Returns true if field destination is set (has been asigned a value) and false otherwise */ public boolean isSetDestination() { return this.destination != null; } public void setDestinationIsSet(boolean value) { if (!value) { this.destination = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case EVENT: if (value == null) { unsetEvent(); } else { setEvent((String)value); } break; case ID: if (value == null) { unsetId(); } else { setId((Integer)value); } break; case TYPE: if (value == null) { unsetType(); } else { setType((ElementType)value); } break; case DESTINATION: if (value == null) { unsetDestination(); } else { setDestination((Destination)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case EVENT: return getEvent(); case ID: return new Integer(getId()); case TYPE: return getType(); case DESTINATION: return getDestination(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case EVENT: return isSetEvent(); case ID: return isSetId(); case TYPE: return isSetType(); case DESTINATION: return isSetDestination(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Event) return this.equals((Event)that); return false; } public boolean equals(Event that) { if (that == null) return false; boolean this_present_event = true && this.isSetEvent(); boolean that_present_event = true && that.isSetEvent(); if (this_present_event || that_present_event) { if (!(this_present_event && that_present_event)) return false; if (!this.event.equals(that.event)) return false; } boolean this_present_id = true && this.isSetId(); boolean that_present_id = true && that.isSetId(); if (this_present_id || that_present_id) { if (!(this_present_id && that_present_id)) return false; if (this.id != that.id) return false; } boolean this_present_type = true && this.isSetType(); boolean that_present_type = true && that.isSetType(); if (this_present_type || that_present_type) { if (!(this_present_type && that_present_type)) return false; if (!this.type.equals(that.type)) return false; } boolean this_present_destination = true && this.isSetDestination(); boolean that_present_destination = true && that.isSetDestination(); if (this_present_destination || that_present_destination) { if (!(this_present_destination && that_present_destination)) return false; if (!this.destination.equals(that.destination)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(Event other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; Event typedOther = (Event)other; lastComparison = Boolean.valueOf(isSetEvent()).compareTo(typedOther.isSetEvent()); if (lastComparison != 0) { return lastComparison; } if (isSetEvent()) { lastComparison = TBaseHelper.compareTo(this.event, typedOther.event); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId()); if (lastComparison != 0) { return lastComparison; } if (isSetId()) { lastComparison = TBaseHelper.compareTo(this.id, typedOther.id); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType()); if (lastComparison != 0) { return lastComparison; } if (isSetType()) { lastComparison = TBaseHelper.compareTo(this.type, typedOther.type); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetDestination()).compareTo(typedOther.isSetDestination()); if (lastComparison != 0) { return lastComparison; } if (isSetDestination()) { lastComparison = TBaseHelper.compareTo(this.destination, typedOther.destination); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // EVENT if (field.type == TType.STRING) { this.event = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: // ID if (field.type == TType.I32) { this.id = iprot.readI32(); setIdIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 3: // TYPE if (field.type == TType.I32) { this.type = ElementType.findByValue(iprot.readI32()); } else { TProtocolUtil.skip(iprot, field.type); } break; case 4: // DESTINATION if (field.type == TType.I32) { this.destination = Destination.findByValue(iprot.readI32()); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.event != null) { oprot.writeFieldBegin(EVENT_FIELD_DESC); oprot.writeString(this.event); oprot.writeFieldEnd(); } if (isSetId()) { oprot.writeFieldBegin(ID_FIELD_DESC); oprot.writeI32(this.id); oprot.writeFieldEnd(); } if (this.type != null) { if (isSetType()) { oprot.writeFieldBegin(TYPE_FIELD_DESC); oprot.writeI32(this.type.getValue()); oprot.writeFieldEnd(); } } if (this.destination != null) { if (isSetDestination()) { oprot.writeFieldBegin(DESTINATION_FIELD_DESC); oprot.writeI32(this.destination.getValue()); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("Event("); boolean first = true; sb.append("event:"); if (this.event == null) { sb.append("null"); } else { sb.append(this.event); } first = false; if (isSetId()) { if (!first) sb.append(", "); sb.append("id:"); sb.append(this.id); first = false; } if (isSetType()) { if (!first) sb.append(", "); sb.append("type:"); if (this.type == null) { sb.append("null"); } else { sb.append(this.type); } first = false; } if (isSetDestination()) { if (!first) sb.append(", "); sb.append("destination:"); if (this.destination == null) { sb.append("null"); } else { sb.append(this.destination); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } }