java/com/jetbrains/cef/remote/thrift_codegen/SomeModel.java (518 lines of code) (raw):

/** * Autogenerated by Thrift Compiler (0.19.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package com.jetbrains.cef.remote.thrift_codegen; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) public class SomeModel implements com.jetbrains.cef.remote.thrift.TBase<SomeModel, SomeModel._Fields>, java.io.Serializable, Cloneable, Comparable<SomeModel> { private static final com.jetbrains.cef.remote.thrift.protocol.TStruct STRUCT_DESC = new com.jetbrains.cef.remote.thrift.protocol.TStruct("SomeModel"); private static final com.jetbrains.cef.remote.thrift.protocol.TField X_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("x", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)1); private static final com.jetbrains.cef.remote.thrift.protocol.TField Y_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("y", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)2); private static final com.jetbrains.cef.remote.thrift.protocol.TField LIST_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("list", com.jetbrains.cef.remote.thrift.protocol.TType.LIST, (short)3); private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new SomeModelStandardSchemeFactory(); private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new SomeModelTupleSchemeFactory(); public int x; // required public int y; // required public @com.jetbrains.cef.remote.thrift.annotation.Nullable java.util.List<SomeModel> list; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements com.jetbrains.cef.remote.thrift.TFieldIdEnum { X((short)1, "x"), Y((short)2, "y"), LIST((short)3, "list"); private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ @com.jetbrains.cef.remote.thrift.annotation.Nullable public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // X return X; case 2: // Y return Y; case 3: // LIST return LIST; 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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ @com.jetbrains.cef.remote.thrift.annotation.Nullable public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; private final java.lang.String _fieldName; _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @Override public short getThriftFieldId() { return _thriftId; } @Override public java.lang.String getFieldName() { return _fieldName; } } // isset id assignments private static final int __X_ISSET_ID = 0; private static final int __Y_ISSET_ID = 1; private byte __isset_bitfield = 0; public static final java.util.Map<_Fields, com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData> metaDataMap; static { java.util.Map<_Fields, com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.X, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("x", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.I32))); tmpMap.put(_Fields.Y, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("y", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.I32))); tmpMap.put(_Fields.LIST, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("list", com.jetbrains.cef.remote.thrift.TFieldRequirementType.DEFAULT, new com.jetbrains.cef.remote.thrift.meta_data.ListMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.LIST, new com.jetbrains.cef.remote.thrift.meta_data.StructMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, SomeModel.class)))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SomeModel.class, metaDataMap); } public SomeModel() { } public SomeModel( int x, int y, java.util.List<SomeModel> list) { this(); this.x = x; setXIsSet(true); this.y = y; setYIsSet(true); this.list = list; } /** * Performs a deep copy on <i>other</i>. */ public SomeModel(SomeModel other) { __isset_bitfield = other.__isset_bitfield; this.x = other.x; this.y = other.y; if (other.isSetList()) { java.util.List<SomeModel> __this__list = new java.util.ArrayList<SomeModel>(other.list.size()); for (SomeModel other_element : other.list) { __this__list.add(new SomeModel(other_element)); } this.list = __this__list; } } @Override public SomeModel deepCopy() { return new SomeModel(this); } @Override public void clear() { setXIsSet(false); this.x = 0; setYIsSet(false); this.y = 0; this.list = null; } public int getX() { return this.x; } public SomeModel setX(int x) { this.x = x; setXIsSet(true); return this; } public void unsetX() { __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __X_ISSET_ID); } /** Returns true if field x is set (has been assigned a value) and false otherwise */ public boolean isSetX() { return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __X_ISSET_ID); } public void setXIsSet(boolean value) { __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __X_ISSET_ID, value); } public int getY() { return this.y; } public SomeModel setY(int y) { this.y = y; setYIsSet(true); return this; } public void unsetY() { __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __Y_ISSET_ID); } /** Returns true if field y is set (has been assigned a value) and false otherwise */ public boolean isSetY() { return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __Y_ISSET_ID); } public void setYIsSet(boolean value) { __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __Y_ISSET_ID, value); } public int getListSize() { return (this.list == null) ? 0 : this.list.size(); } @com.jetbrains.cef.remote.thrift.annotation.Nullable public java.util.Iterator<SomeModel> getListIterator() { return (this.list == null) ? null : this.list.iterator(); } public void addToList(SomeModel elem) { if (this.list == null) { this.list = new java.util.ArrayList<SomeModel>(); } this.list.add(elem); } @com.jetbrains.cef.remote.thrift.annotation.Nullable public java.util.List<SomeModel> getList() { return this.list; } public SomeModel setList(@com.jetbrains.cef.remote.thrift.annotation.Nullable java.util.List<SomeModel> list) { this.list = list; return this; } public void unsetList() { this.list = null; } /** Returns true if field list is set (has been assigned a value) and false otherwise */ public boolean isSetList() { return this.list != null; } public void setListIsSet(boolean value) { if (!value) { this.list = null; } } @Override public void setFieldValue(_Fields field, @com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.Object value) { switch (field) { case X: if (value == null) { unsetX(); } else { setX((java.lang.Integer)value); } break; case Y: if (value == null) { unsetY(); } else { setY((java.lang.Integer)value); } break; case LIST: if (value == null) { unsetList(); } else { setList((java.util.List<SomeModel>)value); } break; } } @com.jetbrains.cef.remote.thrift.annotation.Nullable @Override public java.lang.Object getFieldValue(_Fields field) { switch (field) { case X: return getX(); case Y: return getY(); case LIST: return getList(); } throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ @Override public boolean isSet(_Fields field) { if (field == null) { throw new java.lang.IllegalArgumentException(); } switch (field) { case X: return isSetX(); case Y: return isSetY(); case LIST: return isSetList(); } throw new java.lang.IllegalStateException(); } @Override public boolean equals(java.lang.Object that) { if (that instanceof SomeModel) return this.equals((SomeModel)that); return false; } public boolean equals(SomeModel that) { if (that == null) return false; if (this == that) return true; boolean this_present_x = true; boolean that_present_x = true; if (this_present_x || that_present_x) { if (!(this_present_x && that_present_x)) return false; if (this.x != that.x) return false; } boolean this_present_y = true; boolean that_present_y = true; if (this_present_y || that_present_y) { if (!(this_present_y && that_present_y)) return false; if (this.y != that.y) return false; } boolean this_present_list = true && this.isSetList(); boolean that_present_list = true && that.isSetList(); if (this_present_list || that_present_list) { if (!(this_present_list && that_present_list)) return false; if (!this.list.equals(that.list)) return false; } return true; } @Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + x; hashCode = hashCode * 8191 + y; hashCode = hashCode * 8191 + ((isSetList()) ? 131071 : 524287); if (isSetList()) hashCode = hashCode * 8191 + list.hashCode(); return hashCode; } @Override public int compareTo(SomeModel other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = java.lang.Boolean.compare(isSetX(), other.isSetX()); if (lastComparison != 0) { return lastComparison; } if (isSetX()) { lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.x, other.x); if (lastComparison != 0) { return lastComparison; } } lastComparison = java.lang.Boolean.compare(isSetY(), other.isSetY()); if (lastComparison != 0) { return lastComparison; } if (isSetY()) { lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.y, other.y); if (lastComparison != 0) { return lastComparison; } } lastComparison = java.lang.Boolean.compare(isSetList(), other.isSetList()); if (lastComparison != 0) { return lastComparison; } if (isSetList()) { lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.list, other.list); if (lastComparison != 0) { return lastComparison; } } return 0; } @com.jetbrains.cef.remote.thrift.annotation.Nullable @Override public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } @Override public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol iprot) throws com.jetbrains.cef.remote.thrift.TException { scheme(iprot).read(iprot, this); } @Override public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol oprot) throws com.jetbrains.cef.remote.thrift.TException { scheme(oprot).write(oprot, this); } @Override public java.lang.String toString() { java.lang.StringBuilder sb = new java.lang.StringBuilder("SomeModel("); boolean first = true; sb.append("x:"); sb.append(this.x); first = false; if (!first) sb.append(", "); sb.append("y:"); sb.append(this.y); first = false; if (!first) sb.append(", "); sb.append("list:"); if (this.list == null) { sb.append("null"); } else { sb.append(this.list); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws com.jetbrains.cef.remote.thrift.TException { // check for required fields // alas, we cannot check 'x' because it's a primitive and you chose the non-beans generator. // alas, we cannot check 'y' because it's a primitive and you chose the non-beans generator. // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new com.jetbrains.cef.remote.thrift.protocol.TCompactProtocol(new com.jetbrains.cef.remote.thrift.transport.TIOStreamTransport(out))); } catch (com.jetbrains.cef.remote.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.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 com.jetbrains.cef.remote.thrift.protocol.TCompactProtocol(new com.jetbrains.cef.remote.thrift.transport.TIOStreamTransport(in))); } catch (com.jetbrains.cef.remote.thrift.TException te) { throw new java.io.IOException(te); } } private static class SomeModelStandardSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory { @Override public SomeModelStandardScheme getScheme() { return new SomeModelStandardScheme(); } } private static class SomeModelStandardScheme extends com.jetbrains.cef.remote.thrift.scheme.StandardScheme<SomeModel> { @Override public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol iprot, SomeModel struct) throws com.jetbrains.cef.remote.thrift.TException { com.jetbrains.cef.remote.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // X if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) { struct.x = iprot.readI32(); struct.setXIsSet(true); } else { com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // Y if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) { struct.y = iprot.readI32(); struct.setYIsSet(true); } else { com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // LIST if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.LIST) { { com.jetbrains.cef.remote.thrift.protocol.TList _list0 = iprot.readListBegin(); struct.list = new java.util.ArrayList<SomeModel>(_list0.size); @com.jetbrains.cef.remote.thrift.annotation.Nullable SomeModel _elem1; for (int _i2 = 0; _i2 < _list0.size; ++_i2) { _elem1 = new SomeModel(); _elem1.read(iprot); struct.list.add(_elem1); } iprot.readListEnd(); } struct.setListIsSet(true); } else { com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: com.jetbrains.cef.remote.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 if (!struct.isSetX()) { throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'x' was not found in serialized data! Struct: " + toString()); } if (!struct.isSetY()) { throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'y' was not found in serialized data! Struct: " + toString()); } struct.validate(); } @Override public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol oprot, SomeModel struct) throws com.jetbrains.cef.remote.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(X_FIELD_DESC); oprot.writeI32(struct.x); oprot.writeFieldEnd(); oprot.writeFieldBegin(Y_FIELD_DESC); oprot.writeI32(struct.y); oprot.writeFieldEnd(); if (struct.list != null) { oprot.writeFieldBegin(LIST_FIELD_DESC); { oprot.writeListBegin(new com.jetbrains.cef.remote.thrift.protocol.TList(com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, struct.list.size())); for (SomeModel _iter3 : struct.list) { _iter3.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class SomeModelTupleSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory { @Override public SomeModelTupleScheme getScheme() { return new SomeModelTupleScheme(); } } private static class SomeModelTupleScheme extends com.jetbrains.cef.remote.thrift.scheme.TupleScheme<SomeModel> { @Override public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, SomeModel struct) throws com.jetbrains.cef.remote.thrift.TException { com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol oprot = (com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol) prot; oprot.writeI32(struct.x); oprot.writeI32(struct.y); java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetList()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetList()) { { oprot.writeI32(struct.list.size()); for (SomeModel _iter4 : struct.list) { _iter4.write(oprot); } } } } @Override public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, SomeModel struct) throws com.jetbrains.cef.remote.thrift.TException { com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol iprot = (com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol) prot; struct.x = iprot.readI32(); struct.setXIsSet(true); struct.y = iprot.readI32(); struct.setYIsSet(true); java.util.BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { com.jetbrains.cef.remote.thrift.protocol.TList _list5 = iprot.readListBegin(com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT); struct.list = new java.util.ArrayList<SomeModel>(_list5.size); @com.jetbrains.cef.remote.thrift.annotation.Nullable SomeModel _elem6; for (int _i7 = 0; _i7 < _list5.size; ++_i7) { _elem6 = new SomeModel(); _elem6.read(iprot); struct.list.add(_elem6); } } struct.setListIsSet(true); } } } private static <S extends com.jetbrains.cef.remote.thrift.scheme.IScheme> S scheme(com.jetbrains.cef.remote.thrift.protocol.TProtocol proto) { return (com.jetbrains.cef.remote.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); } }