/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
/**
 * Autogenerated by Thrift Compiler (0.17.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.accumulo.core.process.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class MetricResponse implements org.apache.thrift.TBase<MetricResponse, MetricResponse._Fields>, java.io.Serializable, Cloneable, Comparable<MetricResponse> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("MetricResponse");

  private static final org.apache.thrift.protocol.TField SERVER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("serverType", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField SERVER_FIELD_DESC = new org.apache.thrift.protocol.TField("server", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField RESOURCE_GROUP_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceGroup", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField METRICS_FIELD_DESC = new org.apache.thrift.protocol.TField("metrics", org.apache.thrift.protocol.TType.LIST, (short)5);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new MetricResponseStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new MetricResponseTupleSchemeFactory();

  /**
   * 
   * @see MetricSource
   */
  public @org.apache.thrift.annotation.Nullable MetricSource serverType; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String server; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String resourceGroup; // required
  public long timestamp; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> metrics; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    /**
     * 
     * @see MetricSource
     */
    SERVER_TYPE((short)1, "serverType"),
    SERVER((short)2, "server"),
    RESOURCE_GROUP((short)3, "resourceGroup"),
    TIMESTAMP((short)4, "timestamp"),
    METRICS((short)5, "metrics");

    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.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // SERVER_TYPE
          return SERVER_TYPE;
        case 2: // SERVER
          return SERVER;
        case 3: // RESOURCE_GROUP
          return RESOURCE_GROUP;
        case 4: // TIMESTAMP
          return TIMESTAMP;
        case 5: // METRICS
          return METRICS;
        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.
     */
    @org.apache.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 __TIMESTAMP_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.SERVER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("serverType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, MetricSource.class)));
    tmpMap.put(_Fields.SERVER, new org.apache.thrift.meta_data.FieldMetaData("server", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.RESOURCE_GROUP, new org.apache.thrift.meta_data.FieldMetaData("resourceGroup", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.METRICS, new org.apache.thrift.meta_data.FieldMetaData("metrics", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING            , true))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(MetricResponse.class, metaDataMap);
  }

  public MetricResponse() {
  }

  public MetricResponse(
    MetricSource serverType,
    java.lang.String server,
    java.lang.String resourceGroup,
    long timestamp,
    java.util.List<java.nio.ByteBuffer> metrics)
  {
    this();
    this.serverType = serverType;
    this.server = server;
    this.resourceGroup = resourceGroup;
    this.timestamp = timestamp;
    setTimestampIsSet(true);
    this.metrics = metrics;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public MetricResponse(MetricResponse other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetServerType()) {
      this.serverType = other.serverType;
    }
    if (other.isSetServer()) {
      this.server = other.server;
    }
    if (other.isSetResourceGroup()) {
      this.resourceGroup = other.resourceGroup;
    }
    this.timestamp = other.timestamp;
    if (other.isSetMetrics()) {
      java.util.List<java.nio.ByteBuffer> __this__metrics = new java.util.ArrayList<java.nio.ByteBuffer>(other.metrics);
      this.metrics = __this__metrics;
    }
  }

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

  @Override
  public void clear() {
    this.serverType = null;
    this.server = null;
    this.resourceGroup = null;
    setTimestampIsSet(false);
    this.timestamp = 0;
    this.metrics = null;
  }

  /**
   * 
   * @see MetricSource
   */
  @org.apache.thrift.annotation.Nullable
  public MetricSource getServerType() {
    return this.serverType;
  }

  /**
   * 
   * @see MetricSource
   */
  public MetricResponse setServerType(@org.apache.thrift.annotation.Nullable MetricSource serverType) {
    this.serverType = serverType;
    return this;
  }

  public void unsetServerType() {
    this.serverType = null;
  }

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

  public void setServerTypeIsSet(boolean value) {
    if (!value) {
      this.serverType = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getServer() {
    return this.server;
  }

  public MetricResponse setServer(@org.apache.thrift.annotation.Nullable java.lang.String server) {
    this.server = server;
    return this;
  }

  public void unsetServer() {
    this.server = null;
  }

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

  public void setServerIsSet(boolean value) {
    if (!value) {
      this.server = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getResourceGroup() {
    return this.resourceGroup;
  }

  public MetricResponse setResourceGroup(@org.apache.thrift.annotation.Nullable java.lang.String resourceGroup) {
    this.resourceGroup = resourceGroup;
    return this;
  }

  public void unsetResourceGroup() {
    this.resourceGroup = null;
  }

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

  public void setResourceGroupIsSet(boolean value) {
    if (!value) {
      this.resourceGroup = null;
    }
  }

  public long getTimestamp() {
    return this.timestamp;
  }

  public MetricResponse setTimestamp(long timestamp) {
    this.timestamp = timestamp;
    setTimestampIsSet(true);
    return this;
  }

  public void unsetTimestamp() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
  }

  /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
  public boolean isSetTimestamp() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
  }

  public void setTimestampIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
  }

  public int getMetricsSize() {
    return (this.metrics == null) ? 0 : this.metrics.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.nio.ByteBuffer> getMetricsIterator() {
    return (this.metrics == null) ? null : this.metrics.iterator();
  }

  public void addToMetrics(java.nio.ByteBuffer elem) {
    if (this.metrics == null) {
      this.metrics = new java.util.ArrayList<java.nio.ByteBuffer>();
    }
    this.metrics.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.nio.ByteBuffer> getMetrics() {
    return this.metrics;
  }

  public MetricResponse setMetrics(@org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> metrics) {
    this.metrics = metrics;
    return this;
  }

  public void unsetMetrics() {
    this.metrics = null;
  }

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

  public void setMetricsIsSet(boolean value) {
    if (!value) {
      this.metrics = null;
    }
  }

  @Override
  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case SERVER_TYPE:
      if (value == null) {
        unsetServerType();
      } else {
        setServerType((MetricSource)value);
      }
      break;

    case SERVER:
      if (value == null) {
        unsetServer();
      } else {
        setServer((java.lang.String)value);
      }
      break;

    case RESOURCE_GROUP:
      if (value == null) {
        unsetResourceGroup();
      } else {
        setResourceGroup((java.lang.String)value);
      }
      break;

    case TIMESTAMP:
      if (value == null) {
        unsetTimestamp();
      } else {
        setTimestamp((java.lang.Long)value);
      }
      break;

    case METRICS:
      if (value == null) {
        unsetMetrics();
      } else {
        setMetrics((java.util.List<java.nio.ByteBuffer>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  @Override
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case SERVER_TYPE:
      return getServerType();

    case SERVER:
      return getServer();

    case RESOURCE_GROUP:
      return getResourceGroup();

    case TIMESTAMP:
      return getTimestamp();

    case METRICS:
      return getMetrics();

    }
    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 SERVER_TYPE:
      return isSetServerType();
    case SERVER:
      return isSetServer();
    case RESOURCE_GROUP:
      return isSetResourceGroup();
    case TIMESTAMP:
      return isSetTimestamp();
    case METRICS:
      return isSetMetrics();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_serverType = true && this.isSetServerType();
    boolean that_present_serverType = true && that.isSetServerType();
    if (this_present_serverType || that_present_serverType) {
      if (!(this_present_serverType && that_present_serverType))
        return false;
      if (!this.serverType.equals(that.serverType))
        return false;
    }

    boolean this_present_server = true && this.isSetServer();
    boolean that_present_server = true && that.isSetServer();
    if (this_present_server || that_present_server) {
      if (!(this_present_server && that_present_server))
        return false;
      if (!this.server.equals(that.server))
        return false;
    }

    boolean this_present_resourceGroup = true && this.isSetResourceGroup();
    boolean that_present_resourceGroup = true && that.isSetResourceGroup();
    if (this_present_resourceGroup || that_present_resourceGroup) {
      if (!(this_present_resourceGroup && that_present_resourceGroup))
        return false;
      if (!this.resourceGroup.equals(that.resourceGroup))
        return false;
    }

    boolean this_present_timestamp = true;
    boolean that_present_timestamp = true;
    if (this_present_timestamp || that_present_timestamp) {
      if (!(this_present_timestamp && that_present_timestamp))
        return false;
      if (this.timestamp != that.timestamp)
        return false;
    }

    boolean this_present_metrics = true && this.isSetMetrics();
    boolean that_present_metrics = true && that.isSetMetrics();
    if (this_present_metrics || that_present_metrics) {
      if (!(this_present_metrics && that_present_metrics))
        return false;
      if (!this.metrics.equals(that.metrics))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetServerType()) ? 131071 : 524287);
    if (isSetServerType())
      hashCode = hashCode * 8191 + serverType.getValue();

    hashCode = hashCode * 8191 + ((isSetServer()) ? 131071 : 524287);
    if (isSetServer())
      hashCode = hashCode * 8191 + server.hashCode();

    hashCode = hashCode * 8191 + ((isSetResourceGroup()) ? 131071 : 524287);
    if (isSetResourceGroup())
      hashCode = hashCode * 8191 + resourceGroup.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(timestamp);

    hashCode = hashCode * 8191 + ((isSetMetrics()) ? 131071 : 524287);
    if (isSetMetrics())
      hashCode = hashCode * 8191 + metrics.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetServerType(), other.isSetServerType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetServerType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverType, other.serverType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetServer(), other.isSetServer());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetServer()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.server, other.server);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetResourceGroup(), other.isSetResourceGroup());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResourceGroup()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceGroup, other.resourceGroup);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTimestamp(), other.isSetTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMetrics(), other.isSetMetrics());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMetrics()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metrics, other.metrics);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  @Override
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  @Override
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  @Override
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("MetricResponse(");
    boolean first = true;

    sb.append("serverType:");
    if (this.serverType == null) {
      sb.append("null");
    } else {
      sb.append(this.serverType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("server:");
    if (this.server == null) {
      sb.append("null");
    } else {
      sb.append(this.server);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("resourceGroup:");
    if (this.resourceGroup == null) {
      sb.append("null");
    } else {
      sb.append(this.resourceGroup);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("timestamp:");
    sb.append(this.timestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("metrics:");
    if (this.metrics == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.metrics, sb);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.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 org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.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 org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class MetricResponseStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public MetricResponseStandardScheme getScheme() {
      return new MetricResponseStandardScheme();
    }
  }

  private static class MetricResponseStandardScheme extends org.apache.thrift.scheme.StandardScheme<MetricResponse> {

    @Override
    public void read(org.apache.thrift.protocol.TProtocol iprot, MetricResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // SERVER_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.serverType = org.apache.accumulo.core.process.thrift.MetricSource.findByValue(iprot.readI32());
              struct.setServerTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SERVER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.server = iprot.readString();
              struct.setServerIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // RESOURCE_GROUP
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.resourceGroup = iprot.readString();
              struct.setResourceGroupIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // TIMESTAMP
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timestamp = iprot.readI64();
              struct.setTimestampIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // METRICS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.metrics = new java.util.ArrayList<java.nio.ByteBuffer>(_list0.size);
                @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem1;
                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                {
                  _elem1 = iprot.readBinary();
                  struct.metrics.add(_elem1);
                }
                iprot.readListEnd();
              }
              struct.setMetricsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.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(org.apache.thrift.protocol.TProtocol oprot, MetricResponse struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.serverType != null) {
        oprot.writeFieldBegin(SERVER_TYPE_FIELD_DESC);
        oprot.writeI32(struct.serverType.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.server != null) {
        oprot.writeFieldBegin(SERVER_FIELD_DESC);
        oprot.writeString(struct.server);
        oprot.writeFieldEnd();
      }
      if (struct.resourceGroup != null) {
        oprot.writeFieldBegin(RESOURCE_GROUP_FIELD_DESC);
        oprot.writeString(struct.resourceGroup);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
      oprot.writeI64(struct.timestamp);
      oprot.writeFieldEnd();
      if (struct.metrics != null) {
        oprot.writeFieldBegin(METRICS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.metrics.size()));
          for (java.nio.ByteBuffer _iter3 : struct.metrics)
          {
            oprot.writeBinary(_iter3);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class MetricResponseTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public MetricResponseTupleScheme getScheme() {
      return new MetricResponseTupleScheme();
    }
  }

  private static class MetricResponseTupleScheme extends org.apache.thrift.scheme.TupleScheme<MetricResponse> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, MetricResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetServerType()) {
        optionals.set(0);
      }
      if (struct.isSetServer()) {
        optionals.set(1);
      }
      if (struct.isSetResourceGroup()) {
        optionals.set(2);
      }
      if (struct.isSetTimestamp()) {
        optionals.set(3);
      }
      if (struct.isSetMetrics()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetServerType()) {
        oprot.writeI32(struct.serverType.getValue());
      }
      if (struct.isSetServer()) {
        oprot.writeString(struct.server);
      }
      if (struct.isSetResourceGroup()) {
        oprot.writeString(struct.resourceGroup);
      }
      if (struct.isSetTimestamp()) {
        oprot.writeI64(struct.timestamp);
      }
      if (struct.isSetMetrics()) {
        {
          oprot.writeI32(struct.metrics.size());
          for (java.nio.ByteBuffer _iter4 : struct.metrics)
          {
            oprot.writeBinary(_iter4);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, MetricResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        struct.serverType = org.apache.accumulo.core.process.thrift.MetricSource.findByValue(iprot.readI32());
        struct.setServerTypeIsSet(true);
      }
      if (incoming.get(1)) {
        struct.server = iprot.readString();
        struct.setServerIsSet(true);
      }
      if (incoming.get(2)) {
        struct.resourceGroup = iprot.readString();
        struct.setResourceGroupIsSet(true);
      }
      if (incoming.get(3)) {
        struct.timestamp = iprot.readI64();
        struct.setTimestampIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TList _list5 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
          struct.metrics = new java.util.ArrayList<java.nio.ByteBuffer>(_list5.size);
          @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem6;
          for (int _i7 = 0; _i7 < _list5.size; ++_i7)
          {
            _elem6 = iprot.readBinary();
            struct.metrics.add(_elem6);
          }
        }
        struct.setMetricsIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
  private static void unusedMethod() {}
}

