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

  private static final com.jetbrains.cef.remote.thrift.protocol.TField RANGE_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("range", com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, (short)1);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField COLOR_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("color", com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, (short)2);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField BACKGROUND_COLOR_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("backgroundColor", com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, (short)3);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField THICK_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("thick", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)4);
  private static final com.jetbrains.cef.remote.thrift.protocol.TField STYLE_FIELD_DESC = new com.jetbrains.cef.remote.thrift.protocol.TField("style", com.jetbrains.cef.remote.thrift.protocol.TType.I32, (short)5);

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

  public @com.jetbrains.cef.remote.thrift.annotation.Nullable Range range; // required
  public @com.jetbrains.cef.remote.thrift.annotation.Nullable Color color; // required
  public @com.jetbrains.cef.remote.thrift.annotation.Nullable Color backgroundColor; // required
  public int thick; // required
  /**
   * 
   * @see Style
   */
  public @com.jetbrains.cef.remote.thrift.annotation.Nullable Style style; // 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 {
    RANGE((short)1, "range"),
    COLOR((short)2, "color"),
    BACKGROUND_COLOR((short)3, "backgroundColor"),
    THICK((short)4, "thick"),
    /**
     * 
     * @see Style
     */
    STYLE((short)5, "style");

    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: // RANGE
          return RANGE;
        case 2: // COLOR
          return COLOR;
        case 3: // BACKGROUND_COLOR
          return BACKGROUND_COLOR;
        case 4: // THICK
          return THICK;
        case 5: // STYLE
          return STYLE;
        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 __THICK_ISSET_ID = 0;
  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.RANGE, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("range", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.StructMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, Range.class)));
    tmpMap.put(_Fields.COLOR, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("color", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.StructMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, Color.class)));
    tmpMap.put(_Fields.BACKGROUND_COLOR, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("backgroundColor", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.StructMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT, Color.class)));
    tmpMap.put(_Fields.THICK, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("thick", 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.STYLE, new com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData("style", com.jetbrains.cef.remote.thrift.TFieldRequirementType.REQUIRED, 
        new com.jetbrains.cef.remote.thrift.meta_data.EnumMetaData(com.jetbrains.cef.remote.thrift.protocol.TType.ENUM, Style.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    com.jetbrains.cef.remote.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CompositionUnderline.class, metaDataMap);
  }

  public CompositionUnderline() {
  }

  public CompositionUnderline(
    Range range,
    Color color,
    Color backgroundColor,
    int thick,
    Style style)
  {
    this();
    this.range = range;
    this.color = color;
    this.backgroundColor = backgroundColor;
    this.thick = thick;
    setThickIsSet(true);
    this.style = style;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public CompositionUnderline(CompositionUnderline other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetRange()) {
      this.range = new Range(other.range);
    }
    if (other.isSetColor()) {
      this.color = new Color(other.color);
    }
    if (other.isSetBackgroundColor()) {
      this.backgroundColor = new Color(other.backgroundColor);
    }
    this.thick = other.thick;
    if (other.isSetStyle()) {
      this.style = other.style;
    }
  }

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

  @Override
  public void clear() {
    this.range = null;
    this.color = null;
    this.backgroundColor = null;
    setThickIsSet(false);
    this.thick = 0;
    this.style = null;
  }

  @com.jetbrains.cef.remote.thrift.annotation.Nullable
  public Range getRange() {
    return this.range;
  }

  public CompositionUnderline setRange(@com.jetbrains.cef.remote.thrift.annotation.Nullable Range range) {
    this.range = range;
    return this;
  }

  public void unsetRange() {
    this.range = null;
  }

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

  public void setRangeIsSet(boolean value) {
    if (!value) {
      this.range = null;
    }
  }

  @com.jetbrains.cef.remote.thrift.annotation.Nullable
  public Color getColor() {
    return this.color;
  }

  public CompositionUnderline setColor(@com.jetbrains.cef.remote.thrift.annotation.Nullable Color color) {
    this.color = color;
    return this;
  }

  public void unsetColor() {
    this.color = null;
  }

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

  public void setColorIsSet(boolean value) {
    if (!value) {
      this.color = null;
    }
  }

  @com.jetbrains.cef.remote.thrift.annotation.Nullable
  public Color getBackgroundColor() {
    return this.backgroundColor;
  }

  public CompositionUnderline setBackgroundColor(@com.jetbrains.cef.remote.thrift.annotation.Nullable Color backgroundColor) {
    this.backgroundColor = backgroundColor;
    return this;
  }

  public void unsetBackgroundColor() {
    this.backgroundColor = null;
  }

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

  public void setBackgroundColorIsSet(boolean value) {
    if (!value) {
      this.backgroundColor = null;
    }
  }

  public int getThick() {
    return this.thick;
  }

  public CompositionUnderline setThick(int thick) {
    this.thick = thick;
    setThickIsSet(true);
    return this;
  }

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

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

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

  /**
   * 
   * @see Style
   */
  @com.jetbrains.cef.remote.thrift.annotation.Nullable
  public Style getStyle() {
    return this.style;
  }

  /**
   * 
   * @see Style
   */
  public CompositionUnderline setStyle(@com.jetbrains.cef.remote.thrift.annotation.Nullable Style style) {
    this.style = style;
    return this;
  }

  public void unsetStyle() {
    this.style = null;
  }

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

  public void setStyleIsSet(boolean value) {
    if (!value) {
      this.style = null;
    }
  }

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

    case COLOR:
      if (value == null) {
        unsetColor();
      } else {
        setColor((Color)value);
      }
      break;

    case BACKGROUND_COLOR:
      if (value == null) {
        unsetBackgroundColor();
      } else {
        setBackgroundColor((Color)value);
      }
      break;

    case THICK:
      if (value == null) {
        unsetThick();
      } else {
        setThick((java.lang.Integer)value);
      }
      break;

    case STYLE:
      if (value == null) {
        unsetStyle();
      } else {
        setStyle((Style)value);
      }
      break;

    }
  }

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

    case COLOR:
      return getColor();

    case BACKGROUND_COLOR:
      return getBackgroundColor();

    case THICK:
      return getThick();

    case STYLE:
      return getStyle();

    }
    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 RANGE:
      return isSetRange();
    case COLOR:
      return isSetColor();
    case BACKGROUND_COLOR:
      return isSetBackgroundColor();
    case THICK:
      return isSetThick();
    case STYLE:
      return isSetStyle();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_range = true && this.isSetRange();
    boolean that_present_range = true && that.isSetRange();
    if (this_present_range || that_present_range) {
      if (!(this_present_range && that_present_range))
        return false;
      if (!this.range.equals(that.range))
        return false;
    }

    boolean this_present_color = true && this.isSetColor();
    boolean that_present_color = true && that.isSetColor();
    if (this_present_color || that_present_color) {
      if (!(this_present_color && that_present_color))
        return false;
      if (!this.color.equals(that.color))
        return false;
    }

    boolean this_present_backgroundColor = true && this.isSetBackgroundColor();
    boolean that_present_backgroundColor = true && that.isSetBackgroundColor();
    if (this_present_backgroundColor || that_present_backgroundColor) {
      if (!(this_present_backgroundColor && that_present_backgroundColor))
        return false;
      if (!this.backgroundColor.equals(that.backgroundColor))
        return false;
    }

    boolean this_present_thick = true;
    boolean that_present_thick = true;
    if (this_present_thick || that_present_thick) {
      if (!(this_present_thick && that_present_thick))
        return false;
      if (this.thick != that.thick)
        return false;
    }

    boolean this_present_style = true && this.isSetStyle();
    boolean that_present_style = true && that.isSetStyle();
    if (this_present_style || that_present_style) {
      if (!(this_present_style && that_present_style))
        return false;
      if (!this.style.equals(that.style))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetRange()) ? 131071 : 524287);
    if (isSetRange())
      hashCode = hashCode * 8191 + range.hashCode();

    hashCode = hashCode * 8191 + ((isSetColor()) ? 131071 : 524287);
    if (isSetColor())
      hashCode = hashCode * 8191 + color.hashCode();

    hashCode = hashCode * 8191 + ((isSetBackgroundColor()) ? 131071 : 524287);
    if (isSetBackgroundColor())
      hashCode = hashCode * 8191 + backgroundColor.hashCode();

    hashCode = hashCode * 8191 + thick;

    hashCode = hashCode * 8191 + ((isSetStyle()) ? 131071 : 524287);
    if (isSetStyle())
      hashCode = hashCode * 8191 + style.getValue();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetRange(), other.isSetRange());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRange()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.range, other.range);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetColor(), other.isSetColor());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColor()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.color, other.color);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBackgroundColor(), other.isSetBackgroundColor());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBackgroundColor()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.backgroundColor, other.backgroundColor);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetThick(), other.isSetThick());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetThick()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.thick, other.thick);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStyle(), other.isSetStyle());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStyle()) {
      lastComparison = com.jetbrains.cef.remote.thrift.TBaseHelper.compareTo(this.style, other.style);
      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("CompositionUnderline(");
    boolean first = true;

    sb.append("range:");
    if (this.range == null) {
      sb.append("null");
    } else {
      sb.append(this.range);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("color:");
    if (this.color == null) {
      sb.append("null");
    } else {
      sb.append(this.color);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("backgroundColor:");
    if (this.backgroundColor == null) {
      sb.append("null");
    } else {
      sb.append(this.backgroundColor);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("thick:");
    sb.append(this.thick);
    first = false;
    if (!first) sb.append(", ");
    sb.append("style:");
    if (this.style == null) {
      sb.append("null");
    } else {
      sb.append(this.style);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws com.jetbrains.cef.remote.thrift.TException {
    // check for required fields
    if (range == null) {
      throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'range' was not present! Struct: " + toString());
    }
    if (color == null) {
      throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'color' was not present! Struct: " + toString());
    }
    if (backgroundColor == null) {
      throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'backgroundColor' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'thick' because it's a primitive and you chose the non-beans generator.
    if (style == null) {
      throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'style' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (range != null) {
      range.validate();
    }
    if (color != null) {
      color.validate();
    }
    if (backgroundColor != null) {
      backgroundColor.validate();
    }
  }

  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 CompositionUnderlineStandardSchemeFactory implements com.jetbrains.cef.remote.thrift.scheme.SchemeFactory {
    @Override
    public CompositionUnderlineStandardScheme getScheme() {
      return new CompositionUnderlineStandardScheme();
    }
  }

  private static class CompositionUnderlineStandardScheme extends com.jetbrains.cef.remote.thrift.scheme.StandardScheme<CompositionUnderline> {

    @Override
    public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol iprot, CompositionUnderline 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: // RANGE
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT) {
              struct.range = new Range();
              struct.range.read(iprot);
              struct.setRangeIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // COLOR
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT) {
              struct.color = new Color();
              struct.color.read(iprot);
              struct.setColorIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BACKGROUND_COLOR
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.STRUCT) {
              struct.backgroundColor = new Color();
              struct.backgroundColor.read(iprot);
              struct.setBackgroundColorIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // THICK
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) {
              struct.thick = iprot.readI32();
              struct.setThickIsSet(true);
            } else { 
              com.jetbrains.cef.remote.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // STYLE
            if (schemeField.type == com.jetbrains.cef.remote.thrift.protocol.TType.I32) {
              struct.style = com.jetbrains.cef.remote.thrift_codegen.Style.findByValue(iprot.readI32());
              struct.setStyleIsSet(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.isSetThick()) {
        throw new com.jetbrains.cef.remote.thrift.protocol.TProtocolException("Required field 'thick' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.range != null) {
        oprot.writeFieldBegin(RANGE_FIELD_DESC);
        struct.range.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.color != null) {
        oprot.writeFieldBegin(COLOR_FIELD_DESC);
        struct.color.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.backgroundColor != null) {
        oprot.writeFieldBegin(BACKGROUND_COLOR_FIELD_DESC);
        struct.backgroundColor.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(THICK_FIELD_DESC);
      oprot.writeI32(struct.thick);
      oprot.writeFieldEnd();
      if (struct.style != null) {
        oprot.writeFieldBegin(STYLE_FIELD_DESC);
        oprot.writeI32(struct.style.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class CompositionUnderlineTupleScheme extends com.jetbrains.cef.remote.thrift.scheme.TupleScheme<CompositionUnderline> {

    @Override
    public void write(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, CompositionUnderline struct) throws com.jetbrains.cef.remote.thrift.TException {
      com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol oprot = (com.jetbrains.cef.remote.thrift.protocol.TTupleProtocol) prot;
      struct.range.write(oprot);
      struct.color.write(oprot);
      struct.backgroundColor.write(oprot);
      oprot.writeI32(struct.thick);
      oprot.writeI32(struct.style.getValue());
    }

    @Override
    public void read(com.jetbrains.cef.remote.thrift.protocol.TProtocol prot, CompositionUnderline 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.range = new Range();
      struct.range.read(iprot);
      struct.setRangeIsSet(true);
      struct.color = new Color();
      struct.color.read(iprot);
      struct.setColorIsSet(true);
      struct.backgroundColor = new Color();
      struct.backgroundColor.read(iprot);
      struct.setBackgroundColorIsSet(true);
      struct.thick = iprot.readI32();
      struct.setThickIsSet(true);
      struct.style = com.jetbrains.cef.remote.thrift_codegen.Style.findByValue(iprot.readI32());
      struct.setStyleIsSet(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();
  }
}

