/**
 * 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 KeyEvent implements com.jetbrains.cef.remote.thrift.TBase<KeyEvent, KeyEvent._Fields>, java.io.Serializable, Cloneable, Comparable<KeyEvent> {
  private static final com.jetbrains.cef.remote.thrift.protocol.TStruct STRUCT_DESC = new com.jetbrains.cef.remote.thrift.protocol.TStruct("KeyEvent");

  private static final com.jetbrains.cef.remote.thrift.protocol.TField TYPE_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("type", com.jetbrains.cef.remote.thrift.protocol.TType.STRING, (short)1);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField MODIFIERS_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("modifiers", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)2);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField WINDOWS_KEY_CODE_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("windows_key_code", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)3);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField NATIVE_KEY_CODE_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("native_key_code", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)4);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField IS_SYSTEM_KEY_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("is_system_key", com.jetbrains.cef.remote.thrift.protocol.TType.BOOL, (short)5);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField CHARACTER_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("character", com.jetbrains.cef.remote.thrift.protocol.TType.I16, (short)6);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField UNMODIFIED_CHARACTER_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("unmodified_character", com.jetbrains.cef.remote.thrift.protocol.TType.I16, (short)7);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField FOCUS_ON_EDITABLE_FIELD_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("focus_on_editable_field", com.jetbrains.cef.remote.thrift.protocol.TType.BOOL, (short)8);

  private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new KeyEventStandardSchemeFactory();
  private static final com.jetbrains.cef.remote.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new KeyEventTupleSchemeFactory();

  public @com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.String type; // required
  public int modifiers; // required
  public int windows_key_code; // required
  public int native_key_code; // required
  public boolean is_system_key; // required
  public short character; // required
  public short unmodified_character; // required
  public boolean focus_on_editable_field; // 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 {
    TYPE((short)1, "type"),
    MODIFIERS((short)2, "modifiers"),
    WINDOWS_KEY_CODE((short)3, "windows_key_code"),
    NATIVE_KEY_CODE((short)4, "native_key_code"),
    IS_SYSTEM_KEY((short)5, "is_system_key"),
    CHARACTER((short)6, "character"),
    UNMODIFIED_CHARACTER((short)7, "unmodified_character"),
    FOCUS_ON_EDITABLE_FIELD((short)8, "focus_on_editable_field");

    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: // TYPE
          return TYPE;
        case 2: // MODIFIERS
          return MODIFIERS;
        case 3: // WINDOWS_KEY_CODE
          return WINDOWS_KEY_CODE;
        case 4: // NATIVE_KEY_CODE
          return NATIVE_KEY_CODE;
        case 5: // IS_SYSTEM_KEY
          return IS_SYSTEM_KEY;
        case 6: // CHARACTER
          return CHARACTER;
        case 7: // UNMODIFIED_CHARACTER
          return UNMODIFIED_CHARACTER;
        case 8: // FOCUS_ON_EDITABLE_FIELD
          return FOCUS_ON_EDITABLE_FIELD;
        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 __MODIFIERS_ISSET_ID = 0;
  private static final int __WINDOWS_KEY_CODE_ISSET_ID = 1;
  private static final int __NATIVE_KEY_CODE_ISSET_ID = 2;
  private static final int __IS_SYSTEM_KEY_ISSET_ID = 3;
  private static final int __CHARACTER_ISSET_ID = 4;
  private static final int __UNMODIFIED_CHARACTER_ISSET_ID = 5;
  private static final int __FOCUS_ON_EDITABLE_FIELD_ISSET_ID = 6;
  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.TYPE, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("type", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.MODIFIERS, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("modifiers", 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.WINDOWS_KEY_CODE, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("windows_key_code", 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.NATIVE_KEY_CODE, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("native_key_code", 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.IS_SYSTEM_KEY, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("is_system_key", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.CHARACTER, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("character", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.UNMODIFIED_CHARACTER, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("unmodified_character", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.FOCUS_ON_EDITABLE_FIELD, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("focus_on_editable_field", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.FieldValueMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.BOOL)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData.addStructMetaDataMap(KeyEvent.class, metaDataMap);
  }

  public KeyEvent() {
  }

  public KeyEvent(
    java.lang.String type,
    int modifiers,
    int windows_key_code,
    int native_key_code,
    boolean is_system_key,
    short character,
    short unmodified_character,
    boolean focus_on_editable_field)
  {
    this();
    this.type = type;
    this.modifiers = modifiers;
    setModifiersIsSet(true);
    this.windows_key_code = windows_key_code;
    setWindows_key_codeIsSet(true);
    this.native_key_code = native_key_code;
    setNative_key_codeIsSet(true);
    this.is_system_key = is_system_key;
    setIs_system_keyIsSet(true);
    this.character = character;
    setCharacterIsSet(true);
    this.unmodified_character = unmodified_character;
    setUnmodified_characterIsSet(true);
    this.focus_on_editable_field = focus_on_editable_field;
    setFocus_on_editable_fieldIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public KeyEvent(KeyEvent other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetType()) {
      this.type = other.type;
    }
    this.modifiers = other.modifiers;
    this.windows_key_code = other.windows_key_code;
    this.native_key_code = other.native_key_code;
    this.is_system_key = other.is_system_key;
    this.character = other.character;
    this.unmodified_character = other.unmodified_character;
    this.focus_on_editable_field = other.focus_on_editable_field;
  }

  @Override
  public KeyEvent deepCopy() {
    return new KeyEvent(this);
  }

  @Override
  public void clear() {
    this.type = null;
    setModifiersIsSet(false);
    this.modifiers = 0;
    setWindows_key_codeIsSet(false);
    this.windows_key_code = 0;
    setNative_key_codeIsSet(false);
    this.native_key_code = 0;
    setIs_system_keyIsSet(false);
    this.is_system_key = false;
    setCharacterIsSet(false);
    this.character = 0;
    setUnmodified_characterIsSet(false);
    this.unmodified_character = 0;
    setFocus_on_editable_fieldIsSet(false);
    this.focus_on_editable_field = false;
  }

  @com.jetbrains.cef.remote.thrift.annotation.Nullable
  public java.lang.String getType() {
    return this.type;
  }

  public KeyEvent setType(@com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.String type) {
    this.type = type;
    return this;
  }

  public void unsetType() {
    this.type = null;
  }

  /** Returns true if field type is set (has been assigned a value) and false otherwise */
  public boolean isSetType() {
    return this.type != null;
  }

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

  public int getModifiers() {
    return this.modifiers;
  }

  public KeyEvent setModifiers(int modifiers) {
    this.modifiers = modifiers;
    setModifiersIsSet(true);
    return this;
  }

  public void unsetModifiers() {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __MODIFIERS_ISSET_ID);
  }

  /** Returns true if field modifiers is set (has been assigned a value) and false otherwise */
  public boolean isSetModifiers() {
    return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __MODIFIERS_ISSET_ID);
  }

  public void setModifiersIsSet(boolean value) {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __MODIFIERS_ISSET_ID, value);
  }

  public int getWindows_key_code() {
    return this.windows_key_code;
  }

  public KeyEvent setWindows_key_code(int windows_key_code) {
    this.windows_key_code = windows_key_code;
    setWindows_key_codeIsSet(true);
    return this;
  }

  public void unsetWindows_key_code() {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __WINDOWS_KEY_CODE_ISSET_ID);
  }

  /** Returns true if field windows_key_code is set (has been assigned a value) and false otherwise */
  public boolean isSetWindows_key_code() {
    return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __WINDOWS_KEY_CODE_ISSET_ID);
  }

  public void setWindows_key_codeIsSet(boolean value) {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __WINDOWS_KEY_CODE_ISSET_ID, value);
  }

  public int getNative_key_code() {
    return this.native_key_code;
  }

  public KeyEvent setNative_key_code(int native_key_code) {
    this.native_key_code = native_key_code;
    setNative_key_codeIsSet(true);
    return this;
  }

  public void unsetNative_key_code() {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __NATIVE_KEY_CODE_ISSET_ID);
  }

  /** Returns true if field native_key_code is set (has been assigned a value) and false otherwise */
  public boolean isSetNative_key_code() {
    return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __NATIVE_KEY_CODE_ISSET_ID);
  }

  public void setNative_key_codeIsSet(boolean value) {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __NATIVE_KEY_CODE_ISSET_ID, value);
  }

  public boolean isIs_system_key() {
    return this.is_system_key;
  }

  public KeyEvent setIs_system_key(boolean is_system_key) {
    this.is_system_key = is_system_key;
    setIs_system_keyIsSet(true);
    return this;
  }

  public void unsetIs_system_key() {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __IS_SYSTEM_KEY_ISSET_ID);
  }

  /** Returns true if field is_system_key is set (has been assigned a value) and false otherwise */
  public boolean isSetIs_system_key() {
    return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __IS_SYSTEM_KEY_ISSET_ID);
  }

  public void setIs_system_keyIsSet(boolean value) {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __IS_SYSTEM_KEY_ISSET_ID, value);
  }

  public short getCharacter() {
    return this.character;
  }

  public KeyEvent setCharacter(short character) {
    this.character = character;
    setCharacterIsSet(true);
    return this;
  }

  public void unsetCharacter() {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __CHARACTER_ISSET_ID);
  }

  /** Returns true if field character is set (has been assigned a value) and false otherwise */
  public boolean isSetCharacter() {
    return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __CHARACTER_ISSET_ID);
  }

  public void setCharacterIsSet(boolean value) {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __CHARACTER_ISSET_ID, value);
  }

  public short getUnmodified_character() {
    return this.unmodified_character;
  }

  public KeyEvent setUnmodified_character(short unmodified_character) {
    this.unmodified_character = unmodified_character;
    setUnmodified_characterIsSet(true);
    return this;
  }

  public void unsetUnmodified_character() {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __UNMODIFIED_CHARACTER_ISSET_ID);
  }

  /** Returns true if field unmodified_character is set (has been assigned a value) and false otherwise */
  public boolean isSetUnmodified_character() {
    return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __UNMODIFIED_CHARACTER_ISSET_ID);
  }

  public void setUnmodified_characterIsSet(boolean value) {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __UNMODIFIED_CHARACTER_ISSET_ID, value);
  }

  public boolean isFocus_on_editable_field() {
    return this.focus_on_editable_field;
  }

  public KeyEvent setFocus_on_editable_field(boolean focus_on_editable_field) {
    this.focus_on_editable_field = focus_on_editable_field;
    setFocus_on_editable_fieldIsSet(true);
    return this;
  }

  public void unsetFocus_on_editable_field() {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.clearBit(__isset_bitfield, __FOCUS_ON_EDITABLE_FIELD_ISSET_ID);
  }

  /** Returns true if field focus_on_editable_field is set (has been assigned a value) and false otherwise */
  public boolean isSetFocus_on_editable_field() {
    return com.jetbrains.cef.remote.thrift.EncodingUtils.testBit(__isset_bitfield, __FOCUS_ON_EDITABLE_FIELD_ISSET_ID);
  }

  public void setFocus_on_editable_fieldIsSet(boolean value) {
    __isset_bitfield = com.jetbrains.cef.remote.thrift.EncodingUtils.setBit(__isset_bitfield, __FOCUS_ON_EDITABLE_FIELD_ISSET_ID, value);
  }

  @Override
  public void setFieldValue(_Fields field, @com.jetbrains.cef.remote.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((java.lang.String)value);
      }
      break;

    case MODIFIERS:
      if (value == null) {
        unsetModifiers();
      } else {
        setModifiers((java.lang.Integer)value);
      }
      break;

    case WINDOWS_KEY_CODE:
      if (value == null) {
        unsetWindows_key_code();
      } else {
        setWindows_key_code((java.lang.Integer)value);
      }
      break;

    case NATIVE_KEY_CODE:
      if (value == null) {
        unsetNative_key_code();
      } else {
        setNative_key_code((java.lang.Integer)value);
      }
      break;

    case IS_SYSTEM_KEY:
      if (value == null) {
        unsetIs_system_key();
      } else {
        setIs_system_key((java.lang.Boolean)value);
      }
      break;

    case CHARACTER:
      if (value == null) {
        unsetCharacter();
      } else {
        setCharacter((java.lang.Short)value);
      }
      break;

    case UNMODIFIED_CHARACTER:
      if (value == null) {
        unsetUnmodified_character();
      } else {
        setUnmodified_character((java.lang.Short)value);
      }
      break;

    case FOCUS_ON_EDITABLE_FIELD:
      if (value == null) {
        unsetFocus_on_editable_field();
      } else {
        setFocus_on_editable_field((java.lang.Boolean)value);
      }
      break;

    }
  }

  @com.jetbrains.cef.remote.thrift.annotation.Nullable
  @Override
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case TYPE:
      return getType();

    case MODIFIERS:
      return getModifiers();

    case WINDOWS_KEY_CODE:
      return getWindows_key_code();

    case NATIVE_KEY_CODE:
      return getNative_key_code();

    case IS_SYSTEM_KEY:
      return isIs_system_key();

    case CHARACTER:
      return getCharacter();

    case UNMODIFIED_CHARACTER:
      return getUnmodified_character();

    case FOCUS_ON_EDITABLE_FIELD:
      return isFocus_on_editable_field();

    }
    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 TYPE:
      return isSetType();
    case MODIFIERS:
      return isSetModifiers();
    case WINDOWS_KEY_CODE:
      return isSetWindows_key_code();
    case NATIVE_KEY_CODE:
      return isSetNative_key_code();
    case IS_SYSTEM_KEY:
      return isSetIs_system_key();
    case CHARACTER:
      return isSetCharacter();
    case UNMODIFIED_CHARACTER:
      return isSetUnmodified_character();
    case FOCUS_ON_EDITABLE_FIELD:
      return isSetFocus_on_editable_field();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof KeyEvent)
      return this.equals((KeyEvent)that);
    return false;
  }

  public boolean equals(KeyEvent that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    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_modifiers = true;
    boolean that_present_modifiers = true;
    if (this_present_modifiers || that_present_modifiers) {
      if (!(this_present_modifiers && that_present_modifiers))
        return false;
      if (this.modifiers != that.modifiers)
        return false;
    }

    boolean this_present_windows_key_code = true;
    boolean that_present_windows_key_code = true;
    if (this_present_windows_key_code || that_present_windows_key_code) {
      if (!(this_present_windows_key_code && that_present_windows_key_code))
        return false;
      if (this.windows_key_code != that.windows_key_code)
        return false;
    }

    boolean this_present_native_key_code = true;
    boolean that_present_native_key_code = true;
    if (this_present_native_key_code || that_present_native_key_code) {
      if (!(this_present_native_key_code && that_present_native_key_code))
        return false;
      if (this.native_key_code != that.native_key_code)
        return false;
    }

    boolean this_present_is_system_key = true;
    boolean that_present_is_system_key = true;
    if (this_present_is_system_key || that_present_is_system_key) {
      if (!(this_present_is_system_key && that_present_is_system_key))
        return false;
      if (this.is_system_key != that.is_system_key)
        return false;
    }

    boolean this_present_character = true;
    boolean that_present_character = true;
    if (this_present_character || that_present_character) {
      if (!(this_present_character && that_present_character))
        return false;
      if (this.character != that.character)
        return false;
    }

    boolean this_present_unmodified_character = true;
    boolean that_present_unmodified_character = true;
    if (this_present_unmodified_character || that_present_unmodified_character) {
      if (!(this_present_unmodified_character && that_present_unmodified_character))
        return false;
      if (this.unmodified_character != that.unmodified_character)
        return false;
    }

    boolean this_present_focus_on_editable_field = true;
    boolean that_present_focus_on_editable_field = true;
    if (this_present_focus_on_editable_field || that_present_focus_on_editable_field) {
      if (!(this_present_focus_on_editable_field && that_present_focus_on_editable_field))
        return false;
      if (this.focus_on_editable_field != that.focus_on_editable_field)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
    if (isSetType())
      hashCode = hashCode * 8191 + type.hashCode();

    hashCode = hashCode * 8191 + modifiers;

    hashCode = hashCode * 8191 + windows_key_code;

    hashCode = hashCode * 8191 + native_key_code;

    hashCode = hashCode * 8191 + ((is_system_key) ? 131071 : 524287);

    hashCode = hashCode * 8191 + character;

    hashCode = hashCode * 8191 + unmodified_character;

    hashCode = hashCode * 8191 + ((focus_on_editable_field) ? 131071 : 524287);

    return hashCode;
  }

  @Override
  public int compareTo(KeyEvent other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetType(), other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetModifiers(), other.isSetModifiers());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetModifiers()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.modifiers, other.modifiers);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetWindows_key_code(), other.isSetWindows_key_code());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWindows_key_code()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.windows_key_code, other.windows_key_code);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNative_key_code(), other.isSetNative_key_code());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNative_key_code()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.native_key_code, other.native_key_code);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIs_system_key(), other.isSetIs_system_key());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIs_system_key()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.is_system_key, other.is_system_key);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetCharacter(), other.isSetCharacter());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCharacter()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.character, other.character);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetUnmodified_character(), other.isSetUnmodified_character());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUnmodified_character()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.unmodified_character, other.unmodified_character);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFocus_on_editable_field(), other.isSetFocus_on_editable_field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFocus_on_editable_field()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.focus_on_editable_field, other.focus_on_editable_field);
      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("KeyEvent(");
    boolean first = true;

    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("modifiers:");
    sb.append(this.modifiers);
    first = false;
    if (!first) sb.append(", ");
    sb.append("windows_key_code:");
    sb.append(this.windows_key_code);
    first = false;
    if (!first) sb.append(", ");
    sb.append("native_key_code:");
    sb.append(this.native_key_code);
    first = false;
    if (!first) sb.append(", ");
    sb.append("is_system_key:");
    sb.append(this.is_system_key);
    first = false;
    if (!first) sb.append(", ");
    sb.append("character:");
    sb.append(this.character);
    first = false;
    if (!first) sb.append(", ");
    sb.append("unmodified_character:");
    sb.append(this.unmodified_character);
    first = false;
    if (!first) sb.append(", ");
    sb.append("focus_on_editable_field:");
    sb.append(this.focus_on_editable_field);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws com.jetbrains.cef.remote.thrift.TException {
    // check for required fields
    if (type == null) {
      throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'modifiers' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'windows_key_code' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'native_key_code' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'is_system_key' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'character' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'unmodified_character' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'focus_on_editable_field' 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 KeyEventStandardSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory {
    @Override
    public KeyEventStandardScheme getScheme() {
      return new KeyEventStandardScheme();
    }
  }

  private static class KeyEventStandardScheme extends com.jetbrains.cef.remote.thrift.scheme.StandardScheme<KeyEvent> {

    @Override
    public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol iprot, KeyEvent 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: // TYPE
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.STRING) {
              struct.type = iprot.readString();
              struct.setTypeIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MODIFIERS
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) {
              struct.modifiers = iprot.readI32();
              struct.setModifiersIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // WINDOWS_KEY_CODE
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) {
              struct.windows_key_code = iprot.readI32();
              struct.setWindows_key_codeIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // NATIVE_KEY_CODE
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) {
              struct.native_key_code = iprot.readI32();
              struct.setNative_key_codeIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // IS_SYSTEM_KEY
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.BOOL) {
              struct.is_system_key = iprot.readBool();
              struct.setIs_system_keyIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // CHARACTER
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I16) {
              struct.character = iprot.readI16();
              struct.setCharacterIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // UNMODIFIED_CHARACTER
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I16) {
              struct.unmodified_character = iprot.readI16();
              struct.setUnmodified_characterIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // FOCUS_ON_EDITABLE_FIELD
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.BOOL) {
              struct.focus_on_editable_field = iprot.readBool();
              struct.setFocus_on_editable_fieldIsSet(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.isSetModifiers()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'modifiers' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetWindows_key_code()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'windows_key_code' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetNative_key_code()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'native_key_code' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetIs_system_key()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'is_system_key' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetCharacter()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'character' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetUnmodified_character()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'unmodified_character' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetFocus_on_editable_field()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'focus_on_editable_field' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    @Override
    public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol oprot, KeyEvent struct) throws com.jetbrains.cef.remote.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeString(struct.type);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(MODIFIERS_FIELD_DESC);
      oprot.writeI32(struct.modifiers);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(WINDOWS_KEY_CODE_FIELD_DESC);
      oprot.writeI32(struct.windows_key_code);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(NATIVE_KEY_CODE_FIELD_DESC);
      oprot.writeI32(struct.native_key_code);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(IS_SYSTEM_KEY_FIELD_DESC);
      oprot.writeBool(struct.is_system_key);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(CHARACTER_FIELD_DESC);
      oprot.writeI16(struct.character);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(UNMODIFIED_CHARACTER_FIELD_DESC);
      oprot.writeI16(struct.unmodified_character);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(FOCUS_ON_EDITABLE_FIELD_FIELD_DESC);
      oprot.writeBool(struct.focus_on_editable_field);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class KeyEventTupleSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory {
    @Override
    public KeyEventTupleScheme getScheme() {
      return new KeyEventTupleScheme();
    }
  }

  private static class KeyEventTupleScheme extends com.jetbrains.cef.remote.thrift.scheme.TupleScheme<KeyEvent> {

    @Override
    public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, KeyEvent 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.writeString(struct.type);
      oprot.writeI32(struct.modifiers);
      oprot.writeI32(struct.windows_key_code);
      oprot.writeI32(struct.native_key_code);
      oprot.writeBool(struct.is_system_key);
      oprot.writeI16(struct.character);
      oprot.writeI16(struct.unmodified_character);
      oprot.writeBool(struct.focus_on_editable_field);
    }

    @Override
    public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, KeyEvent 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.type = iprot.readString();
      struct.setTypeIsSet(true);
      struct.modifiers = iprot.readI32();
      struct.setModifiersIsSet(true);
      struct.windows_key_code = iprot.readI32();
      struct.setWindows_key_codeIsSet(true);
      struct.native_key_code = iprot.readI32();
      struct.setNative_key_codeIsSet(true);
      struct.is_system_key = iprot.readBool();
      struct.setIs_system_keyIsSet(true);
      struct.character = iprot.readI16();
      struct.setCharacterIsSet(true);
      struct.unmodified_character = iprot.readI16();
      struct.setUnmodified_characterIsSet(true);
      struct.focus_on_editable_field = iprot.readBool();
      struct.setFocus_on_editable_fieldIsSet(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();
  }
}

