/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
public class ShowLocksResponseElement implements org.apache.thrift.TBase<ShowLocksResponseElement, ShowLocksResponseElement._Fields>, java.io.Serializable, Cloneable, Comparable<ShowLocksResponseElement> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ShowLocksResponseElement");

  private static final org.apache.thrift.protocol.TField LOCKID_FIELD_DESC = new org.apache.thrift.protocol.TField("lockid", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField DBNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbname", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField TABLENAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tablename", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField PARTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("partname", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField TXNID_FIELD_DESC = new org.apache.thrift.protocol.TField("txnid", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField LASTHEARTBEAT_FIELD_DESC = new org.apache.thrift.protocol.TField("lastheartbeat", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField ACQUIREDAT_FIELD_DESC = new org.apache.thrift.protocol.TField("acquiredat", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField HOSTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("hostname", org.apache.thrift.protocol.TType.STRING, (short)11);
  private static final org.apache.thrift.protocol.TField HEARTBEAT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("heartbeatCount", org.apache.thrift.protocol.TType.I32, (short)12);
  private static final org.apache.thrift.protocol.TField AGENT_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("agentInfo", org.apache.thrift.protocol.TType.STRING, (short)13);
  private static final org.apache.thrift.protocol.TField BLOCKED_BY_EXT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("blockedByExtId", org.apache.thrift.protocol.TType.I64, (short)14);
  private static final org.apache.thrift.protocol.TField BLOCKED_BY_INT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("blockedByIntId", org.apache.thrift.protocol.TType.I64, (short)15);
  private static final org.apache.thrift.protocol.TField LOCK_ID_INTERNAL_FIELD_DESC = new org.apache.thrift.protocol.TField("lockIdInternal", org.apache.thrift.protocol.TType.I64, (short)16);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new ShowLocksResponseElementStandardSchemeFactory());
    schemes.put(TupleScheme.class, new ShowLocksResponseElementTupleSchemeFactory());
  }

  private long lockid; // required
  private String dbname; // required
  private String tablename; // optional
  private String partname; // optional
  private LockState state; // required
  private LockType type; // required
  private long txnid; // optional
  private long lastheartbeat; // required
  private long acquiredat; // optional
  private String user; // required
  private String hostname; // required
  private int heartbeatCount; // optional
  private String agentInfo; // optional
  private long blockedByExtId; // optional
  private long blockedByIntId; // optional
  private long lockIdInternal; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    LOCKID((short)1, "lockid"),
    DBNAME((short)2, "dbname"),
    TABLENAME((short)3, "tablename"),
    PARTNAME((short)4, "partname"),
    /**
     * 
     * @see LockState
     */
    STATE((short)5, "state"),
    /**
     * 
     * @see LockType
     */
    TYPE((short)6, "type"),
    TXNID((short)7, "txnid"),
    LASTHEARTBEAT((short)8, "lastheartbeat"),
    ACQUIREDAT((short)9, "acquiredat"),
    USER((short)10, "user"),
    HOSTNAME((short)11, "hostname"),
    HEARTBEAT_COUNT((short)12, "heartbeatCount"),
    AGENT_INFO((short)13, "agentInfo"),
    BLOCKED_BY_EXT_ID((short)14, "blockedByExtId"),
    BLOCKED_BY_INT_ID((short)15, "blockedByIntId"),
    LOCK_ID_INTERNAL((short)16, "lockIdInternal");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // LOCKID
          return LOCKID;
        case 2: // DBNAME
          return DBNAME;
        case 3: // TABLENAME
          return TABLENAME;
        case 4: // PARTNAME
          return PARTNAME;
        case 5: // STATE
          return STATE;
        case 6: // TYPE
          return TYPE;
        case 7: // TXNID
          return TXNID;
        case 8: // LASTHEARTBEAT
          return LASTHEARTBEAT;
        case 9: // ACQUIREDAT
          return ACQUIREDAT;
        case 10: // USER
          return USER;
        case 11: // HOSTNAME
          return HOSTNAME;
        case 12: // HEARTBEAT_COUNT
          return HEARTBEAT_COUNT;
        case 13: // AGENT_INFO
          return AGENT_INFO;
        case 14: // BLOCKED_BY_EXT_ID
          return BLOCKED_BY_EXT_ID;
        case 15: // BLOCKED_BY_INT_ID
          return BLOCKED_BY_INT_ID;
        case 16: // LOCK_ID_INTERNAL
          return LOCK_ID_INTERNAL;
        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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __LOCKID_ISSET_ID = 0;
  private static final int __TXNID_ISSET_ID = 1;
  private static final int __LASTHEARTBEAT_ISSET_ID = 2;
  private static final int __ACQUIREDAT_ISSET_ID = 3;
  private static final int __HEARTBEATCOUNT_ISSET_ID = 4;
  private static final int __BLOCKEDBYEXTID_ISSET_ID = 5;
  private static final int __BLOCKEDBYINTID_ISSET_ID = 6;
  private static final int __LOCKIDINTERNAL_ISSET_ID = 7;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.TABLENAME,_Fields.PARTNAME,_Fields.TXNID,_Fields.ACQUIREDAT,_Fields.HEARTBEAT_COUNT,_Fields.AGENT_INFO,_Fields.BLOCKED_BY_EXT_ID,_Fields.BLOCKED_BY_INT_ID,_Fields.LOCK_ID_INTERNAL};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.LOCKID, new org.apache.thrift.meta_data.FieldMetaData("lockid", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DBNAME, new org.apache.thrift.meta_data.FieldMetaData("dbname", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TABLENAME, new org.apache.thrift.meta_data.FieldMetaData("tablename", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PARTNAME, new org.apache.thrift.meta_data.FieldMetaData("partname", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, LockState.class)));
    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, LockType.class)));
    tmpMap.put(_Fields.TXNID, new org.apache.thrift.meta_data.FieldMetaData("txnid", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.LASTHEARTBEAT, new org.apache.thrift.meta_data.FieldMetaData("lastheartbeat", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ACQUIREDAT, new org.apache.thrift.meta_data.FieldMetaData("acquiredat", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.HOSTNAME, new org.apache.thrift.meta_data.FieldMetaData("hostname", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.HEARTBEAT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("heartbeatCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.AGENT_INFO, new org.apache.thrift.meta_data.FieldMetaData("agentInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BLOCKED_BY_EXT_ID, new org.apache.thrift.meta_data.FieldMetaData("blockedByExtId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BLOCKED_BY_INT_ID, new org.apache.thrift.meta_data.FieldMetaData("blockedByIntId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.LOCK_ID_INTERNAL, new org.apache.thrift.meta_data.FieldMetaData("lockIdInternal", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ShowLocksResponseElement.class, metaDataMap);
  }

  public ShowLocksResponseElement() {
    this.heartbeatCount = 0;

  }

  public ShowLocksResponseElement(
    long lockid,
    String dbname,
    LockState state,
    LockType type,
    long lastheartbeat,
    String user,
    String hostname)
  {
    this();
    this.lockid = lockid;
    setLockidIsSet(true);
    this.dbname = dbname;
    this.state = state;
    this.type = type;
    this.lastheartbeat = lastheartbeat;
    setLastheartbeatIsSet(true);
    this.user = user;
    this.hostname = hostname;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ShowLocksResponseElement(ShowLocksResponseElement other) {
    __isset_bitfield = other.__isset_bitfield;
    this.lockid = other.lockid;
    if (other.isSetDbname()) {
      this.dbname = other.dbname;
    }
    if (other.isSetTablename()) {
      this.tablename = other.tablename;
    }
    if (other.isSetPartname()) {
      this.partname = other.partname;
    }
    if (other.isSetState()) {
      this.state = other.state;
    }
    if (other.isSetType()) {
      this.type = other.type;
    }
    this.txnid = other.txnid;
    this.lastheartbeat = other.lastheartbeat;
    this.acquiredat = other.acquiredat;
    if (other.isSetUser()) {
      this.user = other.user;
    }
    if (other.isSetHostname()) {
      this.hostname = other.hostname;
    }
    this.heartbeatCount = other.heartbeatCount;
    if (other.isSetAgentInfo()) {
      this.agentInfo = other.agentInfo;
    }
    this.blockedByExtId = other.blockedByExtId;
    this.blockedByIntId = other.blockedByIntId;
    this.lockIdInternal = other.lockIdInternal;
  }

  public ShowLocksResponseElement deepCopy() {
    return new ShowLocksResponseElement(this);
  }

  @Override
  public void clear() {
    setLockidIsSet(false);
    this.lockid = 0;
    this.dbname = null;
    this.tablename = null;
    this.partname = null;
    this.state = null;
    this.type = null;
    setTxnidIsSet(false);
    this.txnid = 0;
    setLastheartbeatIsSet(false);
    this.lastheartbeat = 0;
    setAcquiredatIsSet(false);
    this.acquiredat = 0;
    this.user = null;
    this.hostname = null;
    this.heartbeatCount = 0;

    this.agentInfo = null;
    setBlockedByExtIdIsSet(false);
    this.blockedByExtId = 0;
    setBlockedByIntIdIsSet(false);
    this.blockedByIntId = 0;
    setLockIdInternalIsSet(false);
    this.lockIdInternal = 0;
  }

  public long getLockid() {
    return this.lockid;
  }

  public void setLockid(long lockid) {
    this.lockid = lockid;
    setLockidIsSet(true);
  }

  public void unsetLockid() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LOCKID_ISSET_ID);
  }

  /** Returns true if field lockid is set (has been assigned a value) and false otherwise */
  public boolean isSetLockid() {
    return EncodingUtils.testBit(__isset_bitfield, __LOCKID_ISSET_ID);
  }

  public void setLockidIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LOCKID_ISSET_ID, value);
  }

  public String getDbname() {
    return this.dbname;
  }

  public void setDbname(String dbname) {
    this.dbname = dbname;
  }

  public void unsetDbname() {
    this.dbname = null;
  }

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

  public void setDbnameIsSet(boolean value) {
    if (!value) {
      this.dbname = null;
    }
  }

  public String getTablename() {
    return this.tablename;
  }

  public void setTablename(String tablename) {
    this.tablename = tablename;
  }

  public void unsetTablename() {
    this.tablename = null;
  }

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

  public void setTablenameIsSet(boolean value) {
    if (!value) {
      this.tablename = null;
    }
  }

  public String getPartname() {
    return this.partname;
  }

  public void setPartname(String partname) {
    this.partname = partname;
  }

  public void unsetPartname() {
    this.partname = null;
  }

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

  public void setPartnameIsSet(boolean value) {
    if (!value) {
      this.partname = null;
    }
  }

  /**
   * 
   * @see LockState
   */
  public LockState getState() {
    return this.state;
  }

  /**
   * 
   * @see LockState
   */
  public void setState(LockState state) {
    this.state = state;
  }

  public void unsetState() {
    this.state = null;
  }

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

  public void setStateIsSet(boolean value) {
    if (!value) {
      this.state = null;
    }
  }

  /**
   * 
   * @see LockType
   */
  public LockType getType() {
    return this.type;
  }

  /**
   * 
   * @see LockType
   */
  public void setType(LockType type) {
    this.type = type;
  }

  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 long getTxnid() {
    return this.txnid;
  }

  public void setTxnid(long txnid) {
    this.txnid = txnid;
    setTxnidIsSet(true);
  }

  public void unsetTxnid() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TXNID_ISSET_ID);
  }

  /** Returns true if field txnid is set (has been assigned a value) and false otherwise */
  public boolean isSetTxnid() {
    return EncodingUtils.testBit(__isset_bitfield, __TXNID_ISSET_ID);
  }

  public void setTxnidIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TXNID_ISSET_ID, value);
  }

  public long getLastheartbeat() {
    return this.lastheartbeat;
  }

  public void setLastheartbeat(long lastheartbeat) {
    this.lastheartbeat = lastheartbeat;
    setLastheartbeatIsSet(true);
  }

  public void unsetLastheartbeat() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LASTHEARTBEAT_ISSET_ID);
  }

  /** Returns true if field lastheartbeat is set (has been assigned a value) and false otherwise */
  public boolean isSetLastheartbeat() {
    return EncodingUtils.testBit(__isset_bitfield, __LASTHEARTBEAT_ISSET_ID);
  }

  public void setLastheartbeatIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LASTHEARTBEAT_ISSET_ID, value);
  }

  public long getAcquiredat() {
    return this.acquiredat;
  }

  public void setAcquiredat(long acquiredat) {
    this.acquiredat = acquiredat;
    setAcquiredatIsSet(true);
  }

  public void unsetAcquiredat() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACQUIREDAT_ISSET_ID);
  }

  /** Returns true if field acquiredat is set (has been assigned a value) and false otherwise */
  public boolean isSetAcquiredat() {
    return EncodingUtils.testBit(__isset_bitfield, __ACQUIREDAT_ISSET_ID);
  }

  public void setAcquiredatIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACQUIREDAT_ISSET_ID, value);
  }

  public String getUser() {
    return this.user;
  }

  public void setUser(String user) {
    this.user = user;
  }

  public void unsetUser() {
    this.user = null;
  }

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

  public void setUserIsSet(boolean value) {
    if (!value) {
      this.user = null;
    }
  }

  public String getHostname() {
    return this.hostname;
  }

  public void setHostname(String hostname) {
    this.hostname = hostname;
  }

  public void unsetHostname() {
    this.hostname = null;
  }

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

  public void setHostnameIsSet(boolean value) {
    if (!value) {
      this.hostname = null;
    }
  }

  public int getHeartbeatCount() {
    return this.heartbeatCount;
  }

  public void setHeartbeatCount(int heartbeatCount) {
    this.heartbeatCount = heartbeatCount;
    setHeartbeatCountIsSet(true);
  }

  public void unsetHeartbeatCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID);
  }

  /** Returns true if field heartbeatCount is set (has been assigned a value) and false otherwise */
  public boolean isSetHeartbeatCount() {
    return EncodingUtils.testBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID);
  }

  public void setHeartbeatCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID, value);
  }

  public String getAgentInfo() {
    return this.agentInfo;
  }

  public void setAgentInfo(String agentInfo) {
    this.agentInfo = agentInfo;
  }

  public void unsetAgentInfo() {
    this.agentInfo = null;
  }

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

  public void setAgentInfoIsSet(boolean value) {
    if (!value) {
      this.agentInfo = null;
    }
  }

  public long getBlockedByExtId() {
    return this.blockedByExtId;
  }

  public void setBlockedByExtId(long blockedByExtId) {
    this.blockedByExtId = blockedByExtId;
    setBlockedByExtIdIsSet(true);
  }

  public void unsetBlockedByExtId() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BLOCKEDBYEXTID_ISSET_ID);
  }

  /** Returns true if field blockedByExtId is set (has been assigned a value) and false otherwise */
  public boolean isSetBlockedByExtId() {
    return EncodingUtils.testBit(__isset_bitfield, __BLOCKEDBYEXTID_ISSET_ID);
  }

  public void setBlockedByExtIdIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BLOCKEDBYEXTID_ISSET_ID, value);
  }

  public long getBlockedByIntId() {
    return this.blockedByIntId;
  }

  public void setBlockedByIntId(long blockedByIntId) {
    this.blockedByIntId = blockedByIntId;
    setBlockedByIntIdIsSet(true);
  }

  public void unsetBlockedByIntId() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BLOCKEDBYINTID_ISSET_ID);
  }

  /** Returns true if field blockedByIntId is set (has been assigned a value) and false otherwise */
  public boolean isSetBlockedByIntId() {
    return EncodingUtils.testBit(__isset_bitfield, __BLOCKEDBYINTID_ISSET_ID);
  }

  public void setBlockedByIntIdIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BLOCKEDBYINTID_ISSET_ID, value);
  }

  public long getLockIdInternal() {
    return this.lockIdInternal;
  }

  public void setLockIdInternal(long lockIdInternal) {
    this.lockIdInternal = lockIdInternal;
    setLockIdInternalIsSet(true);
  }

  public void unsetLockIdInternal() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LOCKIDINTERNAL_ISSET_ID);
  }

  /** Returns true if field lockIdInternal is set (has been assigned a value) and false otherwise */
  public boolean isSetLockIdInternal() {
    return EncodingUtils.testBit(__isset_bitfield, __LOCKIDINTERNAL_ISSET_ID);
  }

  public void setLockIdInternalIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LOCKIDINTERNAL_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case LOCKID:
      if (value == null) {
        unsetLockid();
      } else {
        setLockid((Long)value);
      }
      break;

    case DBNAME:
      if (value == null) {
        unsetDbname();
      } else {
        setDbname((String)value);
      }
      break;

    case TABLENAME:
      if (value == null) {
        unsetTablename();
      } else {
        setTablename((String)value);
      }
      break;

    case PARTNAME:
      if (value == null) {
        unsetPartname();
      } else {
        setPartname((String)value);
      }
      break;

    case STATE:
      if (value == null) {
        unsetState();
      } else {
        setState((LockState)value);
      }
      break;

    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((LockType)value);
      }
      break;

    case TXNID:
      if (value == null) {
        unsetTxnid();
      } else {
        setTxnid((Long)value);
      }
      break;

    case LASTHEARTBEAT:
      if (value == null) {
        unsetLastheartbeat();
      } else {
        setLastheartbeat((Long)value);
      }
      break;

    case ACQUIREDAT:
      if (value == null) {
        unsetAcquiredat();
      } else {
        setAcquiredat((Long)value);
      }
      break;

    case USER:
      if (value == null) {
        unsetUser();
      } else {
        setUser((String)value);
      }
      break;

    case HOSTNAME:
      if (value == null) {
        unsetHostname();
      } else {
        setHostname((String)value);
      }
      break;

    case HEARTBEAT_COUNT:
      if (value == null) {
        unsetHeartbeatCount();
      } else {
        setHeartbeatCount((Integer)value);
      }
      break;

    case AGENT_INFO:
      if (value == null) {
        unsetAgentInfo();
      } else {
        setAgentInfo((String)value);
      }
      break;

    case BLOCKED_BY_EXT_ID:
      if (value == null) {
        unsetBlockedByExtId();
      } else {
        setBlockedByExtId((Long)value);
      }
      break;

    case BLOCKED_BY_INT_ID:
      if (value == null) {
        unsetBlockedByIntId();
      } else {
        setBlockedByIntId((Long)value);
      }
      break;

    case LOCK_ID_INTERNAL:
      if (value == null) {
        unsetLockIdInternal();
      } else {
        setLockIdInternal((Long)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case LOCKID:
      return getLockid();

    case DBNAME:
      return getDbname();

    case TABLENAME:
      return getTablename();

    case PARTNAME:
      return getPartname();

    case STATE:
      return getState();

    case TYPE:
      return getType();

    case TXNID:
      return getTxnid();

    case LASTHEARTBEAT:
      return getLastheartbeat();

    case ACQUIREDAT:
      return getAcquiredat();

    case USER:
      return getUser();

    case HOSTNAME:
      return getHostname();

    case HEARTBEAT_COUNT:
      return getHeartbeatCount();

    case AGENT_INFO:
      return getAgentInfo();

    case BLOCKED_BY_EXT_ID:
      return getBlockedByExtId();

    case BLOCKED_BY_INT_ID:
      return getBlockedByIntId();

    case LOCK_ID_INTERNAL:
      return getLockIdInternal();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case LOCKID:
      return isSetLockid();
    case DBNAME:
      return isSetDbname();
    case TABLENAME:
      return isSetTablename();
    case PARTNAME:
      return isSetPartname();
    case STATE:
      return isSetState();
    case TYPE:
      return isSetType();
    case TXNID:
      return isSetTxnid();
    case LASTHEARTBEAT:
      return isSetLastheartbeat();
    case ACQUIREDAT:
      return isSetAcquiredat();
    case USER:
      return isSetUser();
    case HOSTNAME:
      return isSetHostname();
    case HEARTBEAT_COUNT:
      return isSetHeartbeatCount();
    case AGENT_INFO:
      return isSetAgentInfo();
    case BLOCKED_BY_EXT_ID:
      return isSetBlockedByExtId();
    case BLOCKED_BY_INT_ID:
      return isSetBlockedByIntId();
    case LOCK_ID_INTERNAL:
      return isSetLockIdInternal();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof ShowLocksResponseElement)
      return this.equals((ShowLocksResponseElement)that);
    return false;
  }

  public boolean equals(ShowLocksResponseElement that) {
    if (that == null)
      return false;

    boolean this_present_lockid = true;
    boolean that_present_lockid = true;
    if (this_present_lockid || that_present_lockid) {
      if (!(this_present_lockid && that_present_lockid))
        return false;
      if (this.lockid != that.lockid)
        return false;
    }

    boolean this_present_dbname = true && this.isSetDbname();
    boolean that_present_dbname = true && that.isSetDbname();
    if (this_present_dbname || that_present_dbname) {
      if (!(this_present_dbname && that_present_dbname))
        return false;
      if (!this.dbname.equals(that.dbname))
        return false;
    }

    boolean this_present_tablename = true && this.isSetTablename();
    boolean that_present_tablename = true && that.isSetTablename();
    if (this_present_tablename || that_present_tablename) {
      if (!(this_present_tablename && that_present_tablename))
        return false;
      if (!this.tablename.equals(that.tablename))
        return false;
    }

    boolean this_present_partname = true && this.isSetPartname();
    boolean that_present_partname = true && that.isSetPartname();
    if (this_present_partname || that_present_partname) {
      if (!(this_present_partname && that_present_partname))
        return false;
      if (!this.partname.equals(that.partname))
        return false;
    }

    boolean this_present_state = true && this.isSetState();
    boolean that_present_state = true && that.isSetState();
    if (this_present_state || that_present_state) {
      if (!(this_present_state && that_present_state))
        return false;
      if (!this.state.equals(that.state))
        return false;
    }

    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_txnid = true && this.isSetTxnid();
    boolean that_present_txnid = true && that.isSetTxnid();
    if (this_present_txnid || that_present_txnid) {
      if (!(this_present_txnid && that_present_txnid))
        return false;
      if (this.txnid != that.txnid)
        return false;
    }

    boolean this_present_lastheartbeat = true;
    boolean that_present_lastheartbeat = true;
    if (this_present_lastheartbeat || that_present_lastheartbeat) {
      if (!(this_present_lastheartbeat && that_present_lastheartbeat))
        return false;
      if (this.lastheartbeat != that.lastheartbeat)
        return false;
    }

    boolean this_present_acquiredat = true && this.isSetAcquiredat();
    boolean that_present_acquiredat = true && that.isSetAcquiredat();
    if (this_present_acquiredat || that_present_acquiredat) {
      if (!(this_present_acquiredat && that_present_acquiredat))
        return false;
      if (this.acquiredat != that.acquiredat)
        return false;
    }

    boolean this_present_user = true && this.isSetUser();
    boolean that_present_user = true && that.isSetUser();
    if (this_present_user || that_present_user) {
      if (!(this_present_user && that_present_user))
        return false;
      if (!this.user.equals(that.user))
        return false;
    }

    boolean this_present_hostname = true && this.isSetHostname();
    boolean that_present_hostname = true && that.isSetHostname();
    if (this_present_hostname || that_present_hostname) {
      if (!(this_present_hostname && that_present_hostname))
        return false;
      if (!this.hostname.equals(that.hostname))
        return false;
    }

    boolean this_present_heartbeatCount = true && this.isSetHeartbeatCount();
    boolean that_present_heartbeatCount = true && that.isSetHeartbeatCount();
    if (this_present_heartbeatCount || that_present_heartbeatCount) {
      if (!(this_present_heartbeatCount && that_present_heartbeatCount))
        return false;
      if (this.heartbeatCount != that.heartbeatCount)
        return false;
    }

    boolean this_present_agentInfo = true && this.isSetAgentInfo();
    boolean that_present_agentInfo = true && that.isSetAgentInfo();
    if (this_present_agentInfo || that_present_agentInfo) {
      if (!(this_present_agentInfo && that_present_agentInfo))
        return false;
      if (!this.agentInfo.equals(that.agentInfo))
        return false;
    }

    boolean this_present_blockedByExtId = true && this.isSetBlockedByExtId();
    boolean that_present_blockedByExtId = true && that.isSetBlockedByExtId();
    if (this_present_blockedByExtId || that_present_blockedByExtId) {
      if (!(this_present_blockedByExtId && that_present_blockedByExtId))
        return false;
      if (this.blockedByExtId != that.blockedByExtId)
        return false;
    }

    boolean this_present_blockedByIntId = true && this.isSetBlockedByIntId();
    boolean that_present_blockedByIntId = true && that.isSetBlockedByIntId();
    if (this_present_blockedByIntId || that_present_blockedByIntId) {
      if (!(this_present_blockedByIntId && that_present_blockedByIntId))
        return false;
      if (this.blockedByIntId != that.blockedByIntId)
        return false;
    }

    boolean this_present_lockIdInternal = true && this.isSetLockIdInternal();
    boolean that_present_lockIdInternal = true && that.isSetLockIdInternal();
    if (this_present_lockIdInternal || that_present_lockIdInternal) {
      if (!(this_present_lockIdInternal && that_present_lockIdInternal))
        return false;
      if (this.lockIdInternal != that.lockIdInternal)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List<Object> list = new ArrayList<Object>();

    boolean present_lockid = true;
    list.add(present_lockid);
    if (present_lockid)
      list.add(lockid);

    boolean present_dbname = true && (isSetDbname());
    list.add(present_dbname);
    if (present_dbname)
      list.add(dbname);

    boolean present_tablename = true && (isSetTablename());
    list.add(present_tablename);
    if (present_tablename)
      list.add(tablename);

    boolean present_partname = true && (isSetPartname());
    list.add(present_partname);
    if (present_partname)
      list.add(partname);

    boolean present_state = true && (isSetState());
    list.add(present_state);
    if (present_state)
      list.add(state.getValue());

    boolean present_type = true && (isSetType());
    list.add(present_type);
    if (present_type)
      list.add(type.getValue());

    boolean present_txnid = true && (isSetTxnid());
    list.add(present_txnid);
    if (present_txnid)
      list.add(txnid);

    boolean present_lastheartbeat = true;
    list.add(present_lastheartbeat);
    if (present_lastheartbeat)
      list.add(lastheartbeat);

    boolean present_acquiredat = true && (isSetAcquiredat());
    list.add(present_acquiredat);
    if (present_acquiredat)
      list.add(acquiredat);

    boolean present_user = true && (isSetUser());
    list.add(present_user);
    if (present_user)
      list.add(user);

    boolean present_hostname = true && (isSetHostname());
    list.add(present_hostname);
    if (present_hostname)
      list.add(hostname);

    boolean present_heartbeatCount = true && (isSetHeartbeatCount());
    list.add(present_heartbeatCount);
    if (present_heartbeatCount)
      list.add(heartbeatCount);

    boolean present_agentInfo = true && (isSetAgentInfo());
    list.add(present_agentInfo);
    if (present_agentInfo)
      list.add(agentInfo);

    boolean present_blockedByExtId = true && (isSetBlockedByExtId());
    list.add(present_blockedByExtId);
    if (present_blockedByExtId)
      list.add(blockedByExtId);

    boolean present_blockedByIntId = true && (isSetBlockedByIntId());
    list.add(present_blockedByIntId);
    if (present_blockedByIntId)
      list.add(blockedByIntId);

    boolean present_lockIdInternal = true && (isSetLockIdInternal());
    list.add(present_lockIdInternal);
    if (present_lockIdInternal)
      list.add(lockIdInternal);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetLockid()).compareTo(other.isSetLockid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLockid()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lockid, other.lockid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDbname()).compareTo(other.isSetDbname());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDbname()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbname, other.dbname);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTablename()).compareTo(other.isSetTablename());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTablename()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tablename, other.tablename);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPartname()).compareTo(other.isSetPartname());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartname()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partname, other.partname);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetState()).compareTo(other.isSetState());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetState()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTxnid()).compareTo(other.isSetTxnid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTxnid()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.txnid, other.txnid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLastheartbeat()).compareTo(other.isSetLastheartbeat());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLastheartbeat()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastheartbeat, other.lastheartbeat);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAcquiredat()).compareTo(other.isSetAcquiredat());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAcquiredat()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.acquiredat, other.acquiredat);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUser()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHostname()).compareTo(other.isSetHostname());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHostname()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostname, other.hostname);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHeartbeatCount()).compareTo(other.isSetHeartbeatCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHeartbeatCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.heartbeatCount, other.heartbeatCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAgentInfo()).compareTo(other.isSetAgentInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAgentInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.agentInfo, other.agentInfo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBlockedByExtId()).compareTo(other.isSetBlockedByExtId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBlockedByExtId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blockedByExtId, other.blockedByExtId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBlockedByIntId()).compareTo(other.isSetBlockedByIntId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBlockedByIntId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blockedByIntId, other.blockedByIntId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLockIdInternal()).compareTo(other.isSetLockIdInternal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLockIdInternal()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lockIdInternal, other.lockIdInternal);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ShowLocksResponseElement(");
    boolean first = true;

    sb.append("lockid:");
    sb.append(this.lockid);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dbname:");
    if (this.dbname == null) {
      sb.append("null");
    } else {
      sb.append(this.dbname);
    }
    first = false;
    if (isSetTablename()) {
      if (!first) sb.append(", ");
      sb.append("tablename:");
      if (this.tablename == null) {
        sb.append("null");
      } else {
        sb.append(this.tablename);
      }
      first = false;
    }
    if (isSetPartname()) {
      if (!first) sb.append(", ");
      sb.append("partname:");
      if (this.partname == null) {
        sb.append("null");
      } else {
        sb.append(this.partname);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("state:");
    if (this.state == null) {
      sb.append("null");
    } else {
      sb.append(this.state);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (isSetTxnid()) {
      if (!first) sb.append(", ");
      sb.append("txnid:");
      sb.append(this.txnid);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("lastheartbeat:");
    sb.append(this.lastheartbeat);
    first = false;
    if (isSetAcquiredat()) {
      if (!first) sb.append(", ");
      sb.append("acquiredat:");
      sb.append(this.acquiredat);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("user:");
    if (this.user == null) {
      sb.append("null");
    } else {
      sb.append(this.user);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("hostname:");
    if (this.hostname == null) {
      sb.append("null");
    } else {
      sb.append(this.hostname);
    }
    first = false;
    if (isSetHeartbeatCount()) {
      if (!first) sb.append(", ");
      sb.append("heartbeatCount:");
      sb.append(this.heartbeatCount);
      first = false;
    }
    if (isSetAgentInfo()) {
      if (!first) sb.append(", ");
      sb.append("agentInfo:");
      if (this.agentInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.agentInfo);
      }
      first = false;
    }
    if (isSetBlockedByExtId()) {
      if (!first) sb.append(", ");
      sb.append("blockedByExtId:");
      sb.append(this.blockedByExtId);
      first = false;
    }
    if (isSetBlockedByIntId()) {
      if (!first) sb.append(", ");
      sb.append("blockedByIntId:");
      sb.append(this.blockedByIntId);
      first = false;
    }
    if (isSetLockIdInternal()) {
      if (!first) sb.append(", ");
      sb.append("lockIdInternal:");
      sb.append(this.lockIdInternal);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!isSetLockid()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'lockid' is unset! Struct:" + toString());
    }

    if (!isSetDbname()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'dbname' is unset! Struct:" + toString());
    }

    if (!isSetState()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'state' is unset! Struct:" + toString());
    }

    if (!isSetType()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
    }

    if (!isSetLastheartbeat()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'lastheartbeat' is unset! Struct:" + toString());
    }

    if (!isSetUser()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'user' is unset! Struct:" + toString());
    }

    if (!isSetHostname()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'hostname' is unset! Struct:" + toString());
    }

    // 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, 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 ShowLocksResponseElementStandardSchemeFactory implements SchemeFactory {
    public ShowLocksResponseElementStandardScheme getScheme() {
      return new ShowLocksResponseElementStandardScheme();
    }
  }

  private static class ShowLocksResponseElementStandardScheme extends StandardScheme<ShowLocksResponseElement> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ShowLocksResponseElement 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: // LOCKID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.lockid = iprot.readI64();
              struct.setLockidIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DBNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.dbname = iprot.readString();
              struct.setDbnameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TABLENAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.tablename = iprot.readString();
              struct.setTablenameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PARTNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.partname = iprot.readString();
              struct.setPartnameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // STATE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.state = org.apache.hadoop.hive.metastore.api.LockState.findByValue(iprot.readI32());
              struct.setStateIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = org.apache.hadoop.hive.metastore.api.LockType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // TXNID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.txnid = iprot.readI64();
              struct.setTxnidIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // LASTHEARTBEAT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.lastheartbeat = iprot.readI64();
              struct.setLastheartbeatIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // ACQUIREDAT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.acquiredat = iprot.readI64();
              struct.setAcquiredatIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // USER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.user = iprot.readString();
              struct.setUserIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // HOSTNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.hostname = iprot.readString();
              struct.setHostnameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // HEARTBEAT_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.heartbeatCount = iprot.readI32();
              struct.setHeartbeatCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // AGENT_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.agentInfo = iprot.readString();
              struct.setAgentInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // BLOCKED_BY_EXT_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.blockedByExtId = iprot.readI64();
              struct.setBlockedByExtIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // BLOCKED_BY_INT_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.blockedByIntId = iprot.readI64();
              struct.setBlockedByIntIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 16: // LOCK_ID_INTERNAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.lockIdInternal = iprot.readI64();
              struct.setLockIdInternalIsSet(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();
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, ShowLocksResponseElement struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(LOCKID_FIELD_DESC);
      oprot.writeI64(struct.lockid);
      oprot.writeFieldEnd();
      if (struct.dbname != null) {
        oprot.writeFieldBegin(DBNAME_FIELD_DESC);
        oprot.writeString(struct.dbname);
        oprot.writeFieldEnd();
      }
      if (struct.tablename != null) {
        if (struct.isSetTablename()) {
          oprot.writeFieldBegin(TABLENAME_FIELD_DESC);
          oprot.writeString(struct.tablename);
          oprot.writeFieldEnd();
        }
      }
      if (struct.partname != null) {
        if (struct.isSetPartname()) {
          oprot.writeFieldBegin(PARTNAME_FIELD_DESC);
          oprot.writeString(struct.partname);
          oprot.writeFieldEnd();
        }
      }
      if (struct.state != null) {
        oprot.writeFieldBegin(STATE_FIELD_DESC);
        oprot.writeI32(struct.state.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.isSetTxnid()) {
        oprot.writeFieldBegin(TXNID_FIELD_DESC);
        oprot.writeI64(struct.txnid);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(LASTHEARTBEAT_FIELD_DESC);
      oprot.writeI64(struct.lastheartbeat);
      oprot.writeFieldEnd();
      if (struct.isSetAcquiredat()) {
        oprot.writeFieldBegin(ACQUIREDAT_FIELD_DESC);
        oprot.writeI64(struct.acquiredat);
        oprot.writeFieldEnd();
      }
      if (struct.user != null) {
        oprot.writeFieldBegin(USER_FIELD_DESC);
        oprot.writeString(struct.user);
        oprot.writeFieldEnd();
      }
      if (struct.hostname != null) {
        oprot.writeFieldBegin(HOSTNAME_FIELD_DESC);
        oprot.writeString(struct.hostname);
        oprot.writeFieldEnd();
      }
      if (struct.isSetHeartbeatCount()) {
        oprot.writeFieldBegin(HEARTBEAT_COUNT_FIELD_DESC);
        oprot.writeI32(struct.heartbeatCount);
        oprot.writeFieldEnd();
      }
      if (struct.agentInfo != null) {
        if (struct.isSetAgentInfo()) {
          oprot.writeFieldBegin(AGENT_INFO_FIELD_DESC);
          oprot.writeString(struct.agentInfo);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetBlockedByExtId()) {
        oprot.writeFieldBegin(BLOCKED_BY_EXT_ID_FIELD_DESC);
        oprot.writeI64(struct.blockedByExtId);
        oprot.writeFieldEnd();
      }
      if (struct.isSetBlockedByIntId()) {
        oprot.writeFieldBegin(BLOCKED_BY_INT_ID_FIELD_DESC);
        oprot.writeI64(struct.blockedByIntId);
        oprot.writeFieldEnd();
      }
      if (struct.isSetLockIdInternal()) {
        oprot.writeFieldBegin(LOCK_ID_INTERNAL_FIELD_DESC);
        oprot.writeI64(struct.lockIdInternal);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ShowLocksResponseElementTupleSchemeFactory implements SchemeFactory {
    public ShowLocksResponseElementTupleScheme getScheme() {
      return new ShowLocksResponseElementTupleScheme();
    }
  }

  private static class ShowLocksResponseElementTupleScheme extends TupleScheme<ShowLocksResponseElement> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ShowLocksResponseElement struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeI64(struct.lockid);
      oprot.writeString(struct.dbname);
      oprot.writeI32(struct.state.getValue());
      oprot.writeI32(struct.type.getValue());
      oprot.writeI64(struct.lastheartbeat);
      oprot.writeString(struct.user);
      oprot.writeString(struct.hostname);
      BitSet optionals = new BitSet();
      if (struct.isSetTablename()) {
        optionals.set(0);
      }
      if (struct.isSetPartname()) {
        optionals.set(1);
      }
      if (struct.isSetTxnid()) {
        optionals.set(2);
      }
      if (struct.isSetAcquiredat()) {
        optionals.set(3);
      }
      if (struct.isSetHeartbeatCount()) {
        optionals.set(4);
      }
      if (struct.isSetAgentInfo()) {
        optionals.set(5);
      }
      if (struct.isSetBlockedByExtId()) {
        optionals.set(6);
      }
      if (struct.isSetBlockedByIntId()) {
        optionals.set(7);
      }
      if (struct.isSetLockIdInternal()) {
        optionals.set(8);
      }
      oprot.writeBitSet(optionals, 9);
      if (struct.isSetTablename()) {
        oprot.writeString(struct.tablename);
      }
      if (struct.isSetPartname()) {
        oprot.writeString(struct.partname);
      }
      if (struct.isSetTxnid()) {
        oprot.writeI64(struct.txnid);
      }
      if (struct.isSetAcquiredat()) {
        oprot.writeI64(struct.acquiredat);
      }
      if (struct.isSetHeartbeatCount()) {
        oprot.writeI32(struct.heartbeatCount);
      }
      if (struct.isSetAgentInfo()) {
        oprot.writeString(struct.agentInfo);
      }
      if (struct.isSetBlockedByExtId()) {
        oprot.writeI64(struct.blockedByExtId);
      }
      if (struct.isSetBlockedByIntId()) {
        oprot.writeI64(struct.blockedByIntId);
      }
      if (struct.isSetLockIdInternal()) {
        oprot.writeI64(struct.lockIdInternal);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ShowLocksResponseElement struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.lockid = iprot.readI64();
      struct.setLockidIsSet(true);
      struct.dbname = iprot.readString();
      struct.setDbnameIsSet(true);
      struct.state = org.apache.hadoop.hive.metastore.api.LockState.findByValue(iprot.readI32());
      struct.setStateIsSet(true);
      struct.type = org.apache.hadoop.hive.metastore.api.LockType.findByValue(iprot.readI32());
      struct.setTypeIsSet(true);
      struct.lastheartbeat = iprot.readI64();
      struct.setLastheartbeatIsSet(true);
      struct.user = iprot.readString();
      struct.setUserIsSet(true);
      struct.hostname = iprot.readString();
      struct.setHostnameIsSet(true);
      BitSet incoming = iprot.readBitSet(9);
      if (incoming.get(0)) {
        struct.tablename = iprot.readString();
        struct.setTablenameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.partname = iprot.readString();
        struct.setPartnameIsSet(true);
      }
      if (incoming.get(2)) {
        struct.txnid = iprot.readI64();
        struct.setTxnidIsSet(true);
      }
      if (incoming.get(3)) {
        struct.acquiredat = iprot.readI64();
        struct.setAcquiredatIsSet(true);
      }
      if (incoming.get(4)) {
        struct.heartbeatCount = iprot.readI32();
        struct.setHeartbeatCountIsSet(true);
      }
      if (incoming.get(5)) {
        struct.agentInfo = iprot.readString();
        struct.setAgentInfoIsSet(true);
      }
      if (incoming.get(6)) {
        struct.blockedByExtId = iprot.readI64();
        struct.setBlockedByExtIdIsSet(true);
      }
      if (incoming.get(7)) {
        struct.blockedByIntId = iprot.readI64();
        struct.setBlockedByIntIdIsSet(true);
      }
      if (incoming.get(8)) {
        struct.lockIdInternal = iprot.readI64();
        struct.setLockIdInternalIsSet(true);
      }
    }
  }

}

