/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package org.thrudb.thrudex; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import java.util.Collections; import org.apache.thrift.*; import org.apache.thrift.meta_data.*; import org.apache.thrift.protocol.*; public class Element implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("Element"); private static final TField INDEX_FIELD_DESC = new TField("index", TType.STRING, (short)1); private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)2); private static final TField PAYLOAD_FIELD_DESC = new TField("payload", TType.STRING, (short)3); public String index; public static final int INDEX = 1; public String key; public static final int KEY = 2; public String payload; public static final int PAYLOAD = 3; private final Isset __isset = new Isset(); private static final class Isset implements java.io.Serializable { } public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{ put(INDEX, new FieldMetaData("index", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); put(KEY, new FieldMetaData("key", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); put(PAYLOAD, new FieldMetaData("payload", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); }}); static { FieldMetaData.addStructMetaDataMap(Element.class, metaDataMap); } public Element() { } public Element( String index, String key, String payload) { this(); this.index = index; this.key = key; this.payload = payload; } /** * Performs a deep copy on <i>other</i>. */ public Element(Element other) { if (other.isSetIndex()) { this.index = other.index; } if (other.isSetKey()) { this.key = other.key; } if (other.isSetPayload()) { this.payload = other.payload; } } @Override public Element clone() { return new Element(this); } public String getIndex() { return this.index; } public void setIndex(String index) { this.index = index; } public void unsetIndex() { this.index = null; } // Returns true if field index is set (has been asigned a value) and false otherwise public boolean isSetIndex() { return this.index != null; } public void setIndexIsSet(boolean value) { if (!value) { this.index = null; } } public String getKey() { return this.key; } public void setKey(String key) { this.key = key; } public void unsetKey() { this.key = null; } // Returns true if field key is set (has been asigned a value) and false otherwise public boolean isSetKey() { return this.key != null; } public void setKeyIsSet(boolean value) { if (!value) { this.key = null; } } public String getPayload() { return this.payload; } public void setPayload(String payload) { this.payload = payload; } public void unsetPayload() { this.payload = null; } // Returns true if field payload is set (has been asigned a value) and false otherwise public boolean isSetPayload() { return this.payload != null; } public void setPayloadIsSet(boolean value) { if (!value) { this.payload = null; } } public void setFieldValue(int fieldID, Object value) { switch (fieldID) { case INDEX: if (value == null) { unsetIndex(); } else { setIndex((String)value); } break; case KEY: if (value == null) { unsetKey(); } else { setKey((String)value); } break; case PAYLOAD: if (value == null) { unsetPayload(); } else { setPayload((String)value); } break; default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } public Object getFieldValue(int fieldID) { switch (fieldID) { case INDEX: return getIndex(); case KEY: return getKey(); case PAYLOAD: return getPayload(); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise public boolean isSet(int fieldID) { switch (fieldID) { case INDEX: return isSetIndex(); case KEY: return isSetKey(); case PAYLOAD: return isSetPayload(); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Element) return this.equals((Element)that); return false; } public boolean equals(Element that) { if (that == null) return false; boolean this_present_index = true && this.isSetIndex(); boolean that_present_index = true && that.isSetIndex(); if (this_present_index || that_present_index) { if (!(this_present_index && that_present_index)) return false; if (!this.index.equals(that.index)) return false; } boolean this_present_key = true && this.isSetKey(); boolean that_present_key = true && that.isSetKey(); if (this_present_key || that_present_key) { if (!(this_present_key && that_present_key)) return false; if (!this.key.equals(that.key)) return false; } boolean this_present_payload = true && this.isSetPayload(); boolean that_present_payload = true && that.isSetPayload(); if (this_present_payload || that_present_payload) { if (!(this_present_payload && that_present_payload)) return false; if (!this.payload.equals(that.payload)) return false; } return true; } @Override public int hashCode() { return 0; } 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 INDEX: if (field.type == TType.STRING) { this.index = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case KEY: if (field.type == TType.STRING) { this.key = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case PAYLOAD: if (field.type == TType.STRING) { this.payload = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } 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.index != null) { oprot.writeFieldBegin(INDEX_FIELD_DESC); oprot.writeString(this.index); oprot.writeFieldEnd(); } if (this.key != null) { oprot.writeFieldBegin(KEY_FIELD_DESC); oprot.writeString(this.key); oprot.writeFieldEnd(); } if (this.payload != null) { oprot.writeFieldBegin(PAYLOAD_FIELD_DESC); oprot.writeString(this.payload); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("Element("); boolean first = true; sb.append("index:"); if (this.index == null) { sb.append("null"); } else { sb.append(this.index); } first = false; if (!first) sb.append(", "); sb.append("key:"); if (this.key == null) { sb.append("null"); } else { sb.append(this.key); } first = false; if (!first) sb.append(", "); sb.append("payload:"); if (this.payload == null) { sb.append("null"); } else { sb.append(this.payload); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields // check that fields of type enum have valid values } }