java/com/jetbrains/cef/remote/thrift_codegen/ResponseHeaders.java (387 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 ResponseHeaders implements com.jetbrains.cef.remote.thrift.TBase<ResponseHeaders, ResponseHeaders._Fields>, java.io.Serializable, Cloneable, Comparable<ResponseHeaders> { private static final com.jetbrains.cef.remote.thrift.protocol.TStruct STRUCT_DESC = new com.jetbrains.cef.remote.thrift.protocol.TStruct("ResponseHeaders"); private static final com.jetbrains.cef.remote.thrift.protocol.TField LENGTH_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("length", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)1); private static final com.jetbrains.cef.remote.thrift.protocol.TField REDIRECT_URL_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("redirectUrl", com.jetbrains.cef.remote.thrift.protocol.TType.STRING, (short)2); private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ResponseHeadersStandardSchemeFactory(); private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ResponseHeadersTupleSchemeFactory(); public int length; // required public @com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.String redirectUrl; // 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 { LENGTH((short)1, "length"), REDIRECT_URL((short)2, "redirectUrl"); 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: // LENGTH return LENGTH; case 2: // REDIRECT_URL return REDIRECT_URL; 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 __LENGTH_ISSET_ID = 0; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.REDIRECT_URL}; 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.LENGTH, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("length", 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.REDIRECT_URL, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("redirectUrl", com.jetbrains.cef.remote.thrift.TFieldRequirementType.OPTIONAL, new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.STRING))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ResponseHeaders.class, metaDataMap); } public ResponseHeaders() { this.length = 0; } public ResponseHeaders( int length) { this(); this.length = length; setLengthIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public ResponseHeaders(ResponseHeaders other) { __isset_bitfield = other.__isset_bitfield; this.length = other.length; if (other.isSetRedirectUrl()) { this.redirectUrl = other.redirectUrl; } } @Override public ResponseHeaders deepCopy() { return new ResponseHeaders(this); } @Override public void clear() { this.length = 0; this.redirectUrl = null; } public int getLength() { return this.length; } public ResponseHeaders setLength(int length) { this.length = length; setLengthIsSet(true); return this; } public void unsetLength() { __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __LENGTH_ISSET_ID); } /** Returns true if field length is set (has been assigned a value) and false otherwise */ public boolean isSetLength() { return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __LENGTH_ISSET_ID); } public void setLengthIsSet(boolean value) { __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __LENGTH_ISSET_ID, value); } @com.jetbrains.cef.remote.thrift.annotation.Nullable public java.lang.String getRedirectUrl() { return this.redirectUrl; } public ResponseHeaders setRedirectUrl(@com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.String redirectUrl) { this.redirectUrl = redirectUrl; return this; } public void unsetRedirectUrl() { this.redirectUrl = null; } /** Returns true if field redirectUrl is set (has been assigned a value) and false otherwise */ public boolean isSetRedirectUrl() { return this.redirectUrl != null; } public void setRedirectUrlIsSet(boolean value) { if (!value) { this.redirectUrl = null; } } @Override public void setFieldValue(_Fields field, @com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.Object value) { switch (field) { case LENGTH: if (value == null) { unsetLength(); } else { setLength((java.lang.Integer)value); } break; case REDIRECT_URL: if (value == null) { unsetRedirectUrl(); } else { setRedirectUrl((java.lang.String)value); } break; } } @com.jetbrains.cef.remote.thrift.annotation.Nullable @Override public java.lang.Object getFieldValue(_Fields field) { switch (field) { case LENGTH: return getLength(); case REDIRECT_URL: return getRedirectUrl(); } 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 LENGTH: return isSetLength(); case REDIRECT_URL: return isSetRedirectUrl(); } throw new java.lang.IllegalStateException(); } @Override public boolean equals(java.lang.Object that) { if (that instanceof ResponseHeaders) return this.equals((ResponseHeaders)that); return false; } public boolean equals(ResponseHeaders that) { if (that == null) return false; if (this == that) return true; boolean this_present_length = true; boolean that_present_length = true; if (this_present_length || that_present_length) { if (!(this_present_length && that_present_length)) return false; if (this.length != that.length) return false; } boolean this_present_redirectUrl = true && this.isSetRedirectUrl(); boolean that_present_redirectUrl = true && that.isSetRedirectUrl(); if (this_present_redirectUrl || that_present_redirectUrl) { if (!(this_present_redirectUrl && that_present_redirectUrl)) return false; if (!this.redirectUrl.equals(that.redirectUrl)) return false; } return true; } @Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + length; hashCode = hashCode * 8191 + ((isSetRedirectUrl()) ? 131071 : 524287); if (isSetRedirectUrl()) hashCode = hashCode * 8191 + redirectUrl.hashCode(); return hashCode; } @Override public int compareTo(ResponseHeaders other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = java.lang.Boolean.compare(isSetLength(), other.isSetLength()); if (lastComparison != 0) { return lastComparison; } if (isSetLength()) { lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.length, other.length); if (lastComparison != 0) { return lastComparison; } } lastComparison = java.lang.Boolean.compare(isSetRedirectUrl(), other.isSetRedirectUrl()); if (lastComparison != 0) { return lastComparison; } if (isSetRedirectUrl()) { lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.redirectUrl, other.redirectUrl); 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("ResponseHeaders("); boolean first = true; sb.append("length:"); sb.append(this.length); first = false; if (isSetRedirectUrl()) { if (!first) sb.append(", "); sb.append("redirectUrl:"); if (this.redirectUrl == null) { sb.append("null"); } else { sb.append(this.redirectUrl); } 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 'length' 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 ResponseHeadersStandardSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory { @Override public ResponseHeadersStandardScheme getScheme() { return new ResponseHeadersStandardScheme(); } } private static class ResponseHeadersStandardScheme extends com.jetbrains.cef.remote.thrift.scheme.StandardScheme<ResponseHeaders> { @Override public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol iprot, ResponseHeaders 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: // LENGTH if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) { struct.length = iprot.readI32(); struct.setLengthIsSet(true); } else { com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // REDIRECT_URL if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.STRING) { struct.redirectUrl = iprot.readString(); struct.setRedirectUrlIsSet(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.isSetLength()) { throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'length' was not found in serialized data! Struct: " + toString()); } struct.validate(); } @Override public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol oprot, ResponseHeaders struct) throws com.jetbrains.cef.remote.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(LENGTH_FIELD_DESC); oprot.writeI32(struct.length); oprot.writeFieldEnd(); if (struct.redirectUrl != null) { if (struct.isSetRedirectUrl()) { oprot.writeFieldBegin(REDIRECT_URL_FIELD_DESC); oprot.writeString(struct.redirectUrl); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class ResponseHeadersTupleSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory { @Override public ResponseHeadersTupleScheme getScheme() { return new ResponseHeadersTupleScheme(); } } private static class ResponseHeadersTupleScheme extends com.jetbrains.cef.remote.thrift.scheme.TupleScheme<ResponseHeaders> { @Override public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, ResponseHeaders 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.length); java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetRedirectUrl()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetRedirectUrl()) { oprot.writeString(struct.redirectUrl); } } @Override public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, ResponseHeaders 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.length = iprot.readI32(); struct.setLengthIsSet(true); java.util.BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.redirectUrl = iprot.readString(); struct.setRedirectUrlIsSet(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(); } }