java/com/jetbrains/cef/remote/thrift_codegen/ResponseData.java (490 lines of code) (raw):
/**
* Autogenerated by Thrift Compiler (0.20.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 ResponseData implements com.jetbrains.cef.remote.thrift.TBase<ResponseData, ResponseData._Fields>, java.io.Serializable, Cloneable, Comparable<ResponseData> {
private static final com.jetbrains.cef.remote.thrift.protocol.TStruct STRUCT_DESC = new com.jetbrains.cef.remote.thrift.protocol.TStruct("ResponseData");
private static final com.jetbrains.cef.remote.thrift.protocol.TField CONTINUE_READ_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("continueRead", com.jetbrains.cef.remote.thrift.protocol.TType.BOOL, (short)1);
private static final com.jetbrains.cef.remote.thrift.protocol.TField DATA_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("data", com.jetbrains.cef.remote.thrift.protocol.TType.STRING, (short)2);
private static final com.jetbrains.cef.remote.thrift.protocol.TField BYTES_READ_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("bytes_read", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)3);
private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ResponseDataStandardSchemeFactory();
private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ResponseDataTupleSchemeFactory();
public boolean continueRead; // optional
public @com.jetbrains.cef.remote.thrift.annotation.Nullable java.nio.ByteBuffer data; // optional
public int bytes_read; // optional
/** 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 {
CONTINUE_READ((short)1, "continueRead"),
DATA((short)2, "data"),
BYTES_READ((short)3, "bytes_read");
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: // CONTINUE_READ
return CONTINUE_READ;
case 2: // DATA
return DATA;
case 3: // BYTES_READ
return BYTES_READ;
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 __CONTINUEREAD_ISSET_ID = 0;
private static final int __BYTES_READ_ISSET_ID = 1;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.CONTINUE_READ,_Fields.DATA,_Fields.BYTES_READ};
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.CONTINUE_READ, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("continueRead", com.jetbrains.cef.remote.thrift.TFieldRequirementType.OPTIONAL,
new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.DATA, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("data", com.jetbrains.cef.remote.thrift.TFieldRequirementType.OPTIONAL,
new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.BYTES_READ, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("bytes_read", com.jetbrains.cef.remote.thrift.TFieldRequirementType.OPTIONAL,
new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.I32)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ResponseData.class, metaDataMap);
}
public ResponseData() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ResponseData(ResponseData other) {
__isset_bitfield = other.__isset_bitfield;
this.continueRead = other.continueRead;
if (other.isSetData()) {
this.data = com.jetbrains.cef.remote.thrift.TBaseHelper.copyBinary(other.data);
}
this.bytes_read = other.bytes_read;
}
@Override
public ResponseData deepCopy() {
return new ResponseData(this);
}
@Override
public void clear() {
setContinueReadIsSet(false);
this.continueRead = false;
this.data = null;
setBytes_readIsSet(false);
this.bytes_read = 0;
}
public boolean isContinueRead() {
return this.continueRead;
}
public ResponseData setContinueRead(boolean continueRead) {
this.continueRead = continueRead;
setContinueReadIsSet(true);
return this;
}
public void unsetContinueRead() {
__isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __CONTINUEREAD_ISSET_ID);
}
/** Returns true if field continueRead is set (has been assigned a value) and false otherwise */
public boolean isSetContinueRead() {
return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __CONTINUEREAD_ISSET_ID);
}
public void setContinueReadIsSet(boolean value) {
__isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __CONTINUEREAD_ISSET_ID, value);
}
public byte[] getData() {
setData(com.jetbrains.cef.remote.thrift.TBaseHelper.rightSize(data));
return data == null ? null : data.array();
}
public java.nio.ByteBuffer bufferForData() {
return com.jetbrains.cef.remote.thrift.TBaseHelper.copyBinary(data);
}
public ResponseData setData(byte[] data) {
this.data = data == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(data.clone());
return this;
}
public ResponseData setData(@com.jetbrains.cef.remote.thrift.annotation.Nullable java.nio.ByteBuffer data) {
this.data = com.jetbrains.cef.remote.thrift.TBaseHelper.copyBinary(data);
return this;
}
public void unsetData() {
this.data = null;
}
/** Returns true if field data is set (has been assigned a value) and false otherwise */
public boolean isSetData() {
return this.data != null;
}
public void setDataIsSet(boolean value) {
if (!value) {
this.data = null;
}
}
public int getBytes_read() {
return this.bytes_read;
}
public ResponseData setBytes_read(int bytes_read) {
this.bytes_read = bytes_read;
setBytes_readIsSet(true);
return this;
}
public void unsetBytes_read() {
__isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __BYTES_READ_ISSET_ID);
}
/** Returns true if field bytes_read is set (has been assigned a value) and false otherwise */
public boolean isSetBytes_read() {
return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __BYTES_READ_ISSET_ID);
}
public void setBytes_readIsSet(boolean value) {
__isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __BYTES_READ_ISSET_ID, value);
}
@Override
public void setFieldValue(_Fields field, @com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case CONTINUE_READ:
if (value == null) {
unsetContinueRead();
} else {
setContinueRead((java.lang.Boolean)value);
}
break;
case DATA:
if (value == null) {
unsetData();
} else {
if (value instanceof byte[]) {
setData((byte[])value);
} else {
setData((java.nio.ByteBuffer)value);
}
}
break;
case BYTES_READ:
if (value == null) {
unsetBytes_read();
} else {
setBytes_read((java.lang.Integer)value);
}
break;
}
}
@com.jetbrains.cef.remote.thrift.annotation.Nullable
@Override
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case CONTINUE_READ:
return isContinueRead();
case DATA:
return getData();
case BYTES_READ:
return getBytes_read();
}
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 CONTINUE_READ:
return isSetContinueRead();
case DATA:
return isSetData();
case BYTES_READ:
return isSetBytes_read();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that instanceof ResponseData)
return this.equals((ResponseData)that);
return false;
}
public boolean equals(ResponseData that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_continueRead = true && this.isSetContinueRead();
boolean that_present_continueRead = true && that.isSetContinueRead();
if (this_present_continueRead || that_present_continueRead) {
if (!(this_present_continueRead && that_present_continueRead))
return false;
if (this.continueRead != that.continueRead)
return false;
}
boolean this_present_data = true && this.isSetData();
boolean that_present_data = true && that.isSetData();
if (this_present_data || that_present_data) {
if (!(this_present_data && that_present_data))
return false;
if (!this.data.equals(that.data))
return false;
}
boolean this_present_bytes_read = true && this.isSetBytes_read();
boolean that_present_bytes_read = true && that.isSetBytes_read();
if (this_present_bytes_read || that_present_bytes_read) {
if (!(this_present_bytes_read && that_present_bytes_read))
return false;
if (this.bytes_read != that.bytes_read)
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetContinueRead()) ? 131071 : 524287);
if (isSetContinueRead())
hashCode = hashCode * 8191 + ((continueRead) ? 131071 : 524287);
hashCode = hashCode * 8191 + ((isSetData()) ? 131071 : 524287);
if (isSetData())
hashCode = hashCode * 8191 + data.hashCode();
hashCode = hashCode * 8191 + ((isSetBytes_read()) ? 131071 : 524287);
if (isSetBytes_read())
hashCode = hashCode * 8191 + bytes_read;
return hashCode;
}
@Override
public int compareTo(ResponseData other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.compare(isSetContinueRead(), other.isSetContinueRead());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetContinueRead()) {
lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.continueRead, other.continueRead);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetData(), other.isSetData());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetData()) {
lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.data, other.data);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetBytes_read(), other.isSetBytes_read());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBytes_read()) {
lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.bytes_read, other.bytes_read);
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("ResponseData(");
boolean first = true;
if (isSetContinueRead()) {
sb.append("continueRead:");
sb.append(this.continueRead);
first = false;
}
if (isSetData()) {
if (!first) sb.append(", ");
sb.append("data:");
if (this.data == null) {
sb.append("null");
} else {
com.jetbrains.cef.remote.thrift.TBaseHelper.toString(this.data, sb);
}
first = false;
}
if (isSetBytes_read()) {
if (!first) sb.append(", ");
sb.append("bytes_read:");
sb.append(this.bytes_read);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws com.jetbrains.cef.remote.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 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 ResponseDataStandardSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory {
@Override
public ResponseDataStandardScheme getScheme() {
return new ResponseDataStandardScheme();
}
}
private static class ResponseDataStandardScheme extends com.jetbrains.cef.remote.thrift.scheme.StandardScheme<ResponseData> {
@Override
public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol iprot, ResponseData 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: // CONTINUE_READ
if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.BOOL) {
struct.continueRead = iprot.readBool();
struct.setContinueReadIsSet(true);
} else {
com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // DATA
if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.STRING) {
struct.data = iprot.readBinary();
struct.setDataIsSet(true);
} else {
com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // BYTES_READ
if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) {
struct.bytes_read = iprot.readI32();
struct.setBytes_readIsSet(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
struct.validate();
}
@Override
public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol oprot, ResponseData struct) throws com.jetbrains.cef.remote.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.isSetContinueRead()) {
oprot.writeFieldBegin(CONTINUE_READ_FIELD_DESC);
oprot.writeBool(struct.continueRead);
oprot.writeFieldEnd();
}
if (struct.data != null) {
if (struct.isSetData()) {
oprot.writeFieldBegin(DATA_FIELD_DESC);
oprot.writeBinary(struct.data);
oprot.writeFieldEnd();
}
}
if (struct.isSetBytes_read()) {
oprot.writeFieldBegin(BYTES_READ_FIELD_DESC);
oprot.writeI32(struct.bytes_read);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ResponseDataTupleSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory {
@Override
public ResponseDataTupleScheme getScheme() {
return new ResponseDataTupleScheme();
}
}
private static class ResponseDataTupleScheme extends com.jetbrains.cef.remote.thrift.scheme.TupleScheme<ResponseData> {
@Override
public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, ResponseData struct) throws com.jetbrains.cef.remote.thrift.TException {
com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol oprot = (com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetContinueRead()) {
optionals.set(0);
}
if (struct.isSetData()) {
optionals.set(1);
}
if (struct.isSetBytes_read()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetContinueRead()) {
oprot.writeBool(struct.continueRead);
}
if (struct.isSetData()) {
oprot.writeBinary(struct.data);
}
if (struct.isSetBytes_read()) {
oprot.writeI32(struct.bytes_read);
}
}
@Override
public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, ResponseData struct) throws com.jetbrains.cef.remote.thrift.TException {
com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol iprot = (com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.continueRead = iprot.readBool();
struct.setContinueReadIsSet(true);
}
if (incoming.get(1)) {
struct.data = iprot.readBinary();
struct.setDataIsSet(true);
}
if (incoming.get(2)) {
struct.bytes_read = iprot.readI32();
struct.setBytes_readIsSet(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();
}
}