com.databricks.jdbc.client.impl.thrift.generated.TStatus Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (0.19.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*
* @generated
*/
package com.databricks.jdbc.client.impl.thrift.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(
value = "Autogenerated by Thrift Compiler (0.19.0)",
date = "2024-05-06")
public class TStatus
implements org.apache.thrift.TBase,
java.io.Serializable,
Cloneable,
Comparable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
new org.apache.thrift.protocol.TStruct("TStatus");
private static final org.apache.thrift.protocol.TField STATUS_CODE_FIELD_DESC =
new org.apache.thrift.protocol.TField(
"statusCode", org.apache.thrift.protocol.TType.I32, (short) 1);
private static final org.apache.thrift.protocol.TField INFO_MESSAGES_FIELD_DESC =
new org.apache.thrift.protocol.TField(
"infoMessages", org.apache.thrift.protocol.TType.LIST, (short) 2);
private static final org.apache.thrift.protocol.TField SQL_STATE_FIELD_DESC =
new org.apache.thrift.protocol.TField(
"sqlState", org.apache.thrift.protocol.TType.STRING, (short) 3);
private static final org.apache.thrift.protocol.TField ERROR_CODE_FIELD_DESC =
new org.apache.thrift.protocol.TField(
"errorCode", org.apache.thrift.protocol.TType.I32, (short) 4);
private static final org.apache.thrift.protocol.TField ERROR_MESSAGE_FIELD_DESC =
new org.apache.thrift.protocol.TField(
"errorMessage", org.apache.thrift.protocol.TType.STRING, (short) 5);
private static final org.apache.thrift.protocol.TField DISPLAY_MESSAGE_FIELD_DESC =
new org.apache.thrift.protocol.TField(
"displayMessage", org.apache.thrift.protocol.TType.STRING, (short) 6);
private static final org.apache.thrift.protocol.TField ERROR_DETAILS_JSON_FIELD_DESC =
new org.apache.thrift.protocol.TField(
"errorDetailsJson", org.apache.thrift.protocol.TType.STRING, (short) 1281);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY =
new TStatusStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY =
new TStatusTupleSchemeFactory();
/**
* @see TStatusCode
*/
public @org.apache.thrift.annotation.Nullable TStatusCode statusCode; // required
public @org.apache.thrift.annotation.Nullable java.util.List
infoMessages; // optional
public @org.apache.thrift.annotation.Nullable java.lang.String sqlState; // optional
public int errorCode; // optional
public @org.apache.thrift.annotation.Nullable java.lang.String errorMessage; // optional
public @org.apache.thrift.annotation.Nullable java.lang.String displayMessage; // optional
public @org.apache.thrift.annotation.Nullable java.lang.String errorDetailsJson; // 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 {
/**
* @see TStatusCode
*/
STATUS_CODE((short) 1, "statusCode"),
INFO_MESSAGES((short) 2, "infoMessages"),
SQL_STATE((short) 3, "sqlState"),
ERROR_CODE((short) 4, "errorCode"),
ERROR_MESSAGE((short) 5, "errorMessage"),
DISPLAY_MESSAGE((short) 6, "displayMessage"),
ERROR_DETAILS_JSON((short) 1281, "errorDetailsJson");
private static final java.util.Map byName =
new java.util.HashMap();
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: // STATUS_CODE
return STATUS_CODE;
case 2: // INFO_MESSAGES
return INFO_MESSAGES;
case 3: // SQL_STATE
return SQL_STATE;
case 4: // ERROR_CODE
return ERROR_CODE;
case 5: // ERROR_MESSAGE
return ERROR_MESSAGE;
case 6: // DISPLAY_MESSAGE
return DISPLAY_MESSAGE;
case 1281: // ERROR_DETAILS_JSON
return ERROR_DETAILS_JSON;
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 __ERRORCODE_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {
_Fields.INFO_MESSAGES,
_Fields.SQL_STATE,
_Fields.ERROR_CODE,
_Fields.ERROR_MESSAGE,
_Fields.DISPLAY_MESSAGE,
_Fields.ERROR_DETAILS_JSON
};
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.STATUS_CODE,
new org.apache.thrift.meta_data.FieldMetaData(
"statusCode",
org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.EnumMetaData(
org.apache.thrift.protocol.TType.ENUM, TStatusCode.class)));
tmpMap.put(
_Fields.INFO_MESSAGES,
new org.apache.thrift.meta_data.FieldMetaData(
"infoMessages",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
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))));
tmpMap.put(
_Fields.SQL_STATE,
new org.apache.thrift.meta_data.FieldMetaData(
"sqlState",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(
_Fields.ERROR_CODE,
new org.apache.thrift.meta_data.FieldMetaData(
"errorCode",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.I32)));
tmpMap.put(
_Fields.ERROR_MESSAGE,
new org.apache.thrift.meta_data.FieldMetaData(
"errorMessage",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(
_Fields.DISPLAY_MESSAGE,
new org.apache.thrift.meta_data.FieldMetaData(
"displayMessage",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(
_Fields.ERROR_DETAILS_JSON,
new org.apache.thrift.meta_data.FieldMetaData(
"errorDetailsJson",
org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.STRING)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TStatus.class, metaDataMap);
}
public TStatus() {}
public TStatus(TStatusCode statusCode) {
this();
this.statusCode = statusCode;
}
/** Performs a deep copy on other. */
public TStatus(TStatus other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetStatusCode()) {
this.statusCode = other.statusCode;
}
if (other.isSetInfoMessages()) {
java.util.List __this__infoMessages =
new java.util.ArrayList(other.infoMessages);
this.infoMessages = __this__infoMessages;
}
if (other.isSetSqlState()) {
this.sqlState = other.sqlState;
}
this.errorCode = other.errorCode;
if (other.isSetErrorMessage()) {
this.errorMessage = other.errorMessage;
}
if (other.isSetDisplayMessage()) {
this.displayMessage = other.displayMessage;
}
if (other.isSetErrorDetailsJson()) {
this.errorDetailsJson = other.errorDetailsJson;
}
}
@Override
public TStatus deepCopy() {
return new TStatus(this);
}
@Override
public void clear() {
this.statusCode = null;
this.infoMessages = null;
this.sqlState = null;
setErrorCodeIsSet(false);
this.errorCode = 0;
this.errorMessage = null;
this.displayMessage = null;
this.errorDetailsJson = null;
}
/**
* @see TStatusCode
*/
@org.apache.thrift.annotation.Nullable
public TStatusCode getStatusCode() {
return this.statusCode;
}
/**
* @see TStatusCode
*/
public TStatus setStatusCode(@org.apache.thrift.annotation.Nullable TStatusCode statusCode) {
this.statusCode = statusCode;
return this;
}
public void unsetStatusCode() {
this.statusCode = null;
}
/** Returns true if field statusCode is set (has been assigned a value) and false otherwise */
public boolean isSetStatusCode() {
return this.statusCode != null;
}
public void setStatusCodeIsSet(boolean value) {
if (!value) {
this.statusCode = null;
}
}
public int getInfoMessagesSize() {
return (this.infoMessages == null) ? 0 : this.infoMessages.size();
}
@org.apache.thrift.annotation.Nullable
public java.util.Iterator getInfoMessagesIterator() {
return (this.infoMessages == null) ? null : this.infoMessages.iterator();
}
public void addToInfoMessages(java.lang.String elem) {
if (this.infoMessages == null) {
this.infoMessages = new java.util.ArrayList();
}
this.infoMessages.add(elem);
}
@org.apache.thrift.annotation.Nullable
public java.util.List getInfoMessages() {
return this.infoMessages;
}
public TStatus setInfoMessages(
@org.apache.thrift.annotation.Nullable java.util.List infoMessages) {
this.infoMessages = infoMessages;
return this;
}
public void unsetInfoMessages() {
this.infoMessages = null;
}
/** Returns true if field infoMessages is set (has been assigned a value) and false otherwise */
public boolean isSetInfoMessages() {
return this.infoMessages != null;
}
public void setInfoMessagesIsSet(boolean value) {
if (!value) {
this.infoMessages = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getSqlState() {
return this.sqlState;
}
public TStatus setSqlState(@org.apache.thrift.annotation.Nullable java.lang.String sqlState) {
this.sqlState = sqlState;
return this;
}
public void unsetSqlState() {
this.sqlState = null;
}
/** Returns true if field sqlState is set (has been assigned a value) and false otherwise */
public boolean isSetSqlState() {
return this.sqlState != null;
}
public void setSqlStateIsSet(boolean value) {
if (!value) {
this.sqlState = null;
}
}
public int getErrorCode() {
return this.errorCode;
}
public TStatus setErrorCode(int errorCode) {
this.errorCode = errorCode;
setErrorCodeIsSet(true);
return this;
}
public void unsetErrorCode() {
__isset_bitfield =
org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ERRORCODE_ISSET_ID);
}
/** Returns true if field errorCode is set (has been assigned a value) and false otherwise */
public boolean isSetErrorCode() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ERRORCODE_ISSET_ID);
}
public void setErrorCodeIsSet(boolean value) {
__isset_bitfield =
org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ERRORCODE_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getErrorMessage() {
return this.errorMessage;
}
public TStatus setErrorMessage(
@org.apache.thrift.annotation.Nullable java.lang.String errorMessage) {
this.errorMessage = errorMessage;
return this;
}
public void unsetErrorMessage() {
this.errorMessage = null;
}
/** Returns true if field errorMessage is set (has been assigned a value) and false otherwise */
public boolean isSetErrorMessage() {
return this.errorMessage != null;
}
public void setErrorMessageIsSet(boolean value) {
if (!value) {
this.errorMessage = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getDisplayMessage() {
return this.displayMessage;
}
public TStatus setDisplayMessage(
@org.apache.thrift.annotation.Nullable java.lang.String displayMessage) {
this.displayMessage = displayMessage;
return this;
}
public void unsetDisplayMessage() {
this.displayMessage = null;
}
/** Returns true if field displayMessage is set (has been assigned a value) and false otherwise */
public boolean isSetDisplayMessage() {
return this.displayMessage != null;
}
public void setDisplayMessageIsSet(boolean value) {
if (!value) {
this.displayMessage = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getErrorDetailsJson() {
return this.errorDetailsJson;
}
public TStatus setErrorDetailsJson(
@org.apache.thrift.annotation.Nullable java.lang.String errorDetailsJson) {
this.errorDetailsJson = errorDetailsJson;
return this;
}
public void unsetErrorDetailsJson() {
this.errorDetailsJson = null;
}
/**
* Returns true if field errorDetailsJson is set (has been assigned a value) and false otherwise
*/
public boolean isSetErrorDetailsJson() {
return this.errorDetailsJson != null;
}
public void setErrorDetailsJsonIsSet(boolean value) {
if (!value) {
this.errorDetailsJson = null;
}
}
@Override
public void setFieldValue(
_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case STATUS_CODE:
if (value == null) {
unsetStatusCode();
} else {
setStatusCode((TStatusCode) value);
}
break;
case INFO_MESSAGES:
if (value == null) {
unsetInfoMessages();
} else {
setInfoMessages((java.util.List) value);
}
break;
case SQL_STATE:
if (value == null) {
unsetSqlState();
} else {
setSqlState((java.lang.String) value);
}
break;
case ERROR_CODE:
if (value == null) {
unsetErrorCode();
} else {
setErrorCode((java.lang.Integer) value);
}
break;
case ERROR_MESSAGE:
if (value == null) {
unsetErrorMessage();
} else {
setErrorMessage((java.lang.String) value);
}
break;
case DISPLAY_MESSAGE:
if (value == null) {
unsetDisplayMessage();
} else {
setDisplayMessage((java.lang.String) value);
}
break;
case ERROR_DETAILS_JSON:
if (value == null) {
unsetErrorDetailsJson();
} else {
setErrorDetailsJson((java.lang.String) value);
}
break;
}
}
@org.apache.thrift.annotation.Nullable
@Override
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case STATUS_CODE:
return getStatusCode();
case INFO_MESSAGES:
return getInfoMessages();
case SQL_STATE:
return getSqlState();
case ERROR_CODE:
return getErrorCode();
case ERROR_MESSAGE:
return getErrorMessage();
case DISPLAY_MESSAGE:
return getDisplayMessage();
case ERROR_DETAILS_JSON:
return getErrorDetailsJson();
}
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 STATUS_CODE:
return isSetStatusCode();
case INFO_MESSAGES:
return isSetInfoMessages();
case SQL_STATE:
return isSetSqlState();
case ERROR_CODE:
return isSetErrorCode();
case ERROR_MESSAGE:
return isSetErrorMessage();
case DISPLAY_MESSAGE:
return isSetDisplayMessage();
case ERROR_DETAILS_JSON:
return isSetErrorDetailsJson();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that instanceof TStatus) return this.equals((TStatus) that);
return false;
}
public boolean equals(TStatus that) {
if (that == null) return false;
if (this == that) return true;
boolean this_present_statusCode = true && this.isSetStatusCode();
boolean that_present_statusCode = true && that.isSetStatusCode();
if (this_present_statusCode || that_present_statusCode) {
if (!(this_present_statusCode && that_present_statusCode)) return false;
if (!this.statusCode.equals(that.statusCode)) return false;
}
boolean this_present_infoMessages = true && this.isSetInfoMessages();
boolean that_present_infoMessages = true && that.isSetInfoMessages();
if (this_present_infoMessages || that_present_infoMessages) {
if (!(this_present_infoMessages && that_present_infoMessages)) return false;
if (!this.infoMessages.equals(that.infoMessages)) return false;
}
boolean this_present_sqlState = true && this.isSetSqlState();
boolean that_present_sqlState = true && that.isSetSqlState();
if (this_present_sqlState || that_present_sqlState) {
if (!(this_present_sqlState && that_present_sqlState)) return false;
if (!this.sqlState.equals(that.sqlState)) return false;
}
boolean this_present_errorCode = true && this.isSetErrorCode();
boolean that_present_errorCode = true && that.isSetErrorCode();
if (this_present_errorCode || that_present_errorCode) {
if (!(this_present_errorCode && that_present_errorCode)) return false;
if (this.errorCode != that.errorCode) return false;
}
boolean this_present_errorMessage = true && this.isSetErrorMessage();
boolean that_present_errorMessage = true && that.isSetErrorMessage();
if (this_present_errorMessage || that_present_errorMessage) {
if (!(this_present_errorMessage && that_present_errorMessage)) return false;
if (!this.errorMessage.equals(that.errorMessage)) return false;
}
boolean this_present_displayMessage = true && this.isSetDisplayMessage();
boolean that_present_displayMessage = true && that.isSetDisplayMessage();
if (this_present_displayMessage || that_present_displayMessage) {
if (!(this_present_displayMessage && that_present_displayMessage)) return false;
if (!this.displayMessage.equals(that.displayMessage)) return false;
}
boolean this_present_errorDetailsJson = true && this.isSetErrorDetailsJson();
boolean that_present_errorDetailsJson = true && that.isSetErrorDetailsJson();
if (this_present_errorDetailsJson || that_present_errorDetailsJson) {
if (!(this_present_errorDetailsJson && that_present_errorDetailsJson)) return false;
if (!this.errorDetailsJson.equals(that.errorDetailsJson)) return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetStatusCode()) ? 131071 : 524287);
if (isSetStatusCode()) hashCode = hashCode * 8191 + statusCode.getValue();
hashCode = hashCode * 8191 + ((isSetInfoMessages()) ? 131071 : 524287);
if (isSetInfoMessages()) hashCode = hashCode * 8191 + infoMessages.hashCode();
hashCode = hashCode * 8191 + ((isSetSqlState()) ? 131071 : 524287);
if (isSetSqlState()) hashCode = hashCode * 8191 + sqlState.hashCode();
hashCode = hashCode * 8191 + ((isSetErrorCode()) ? 131071 : 524287);
if (isSetErrorCode()) hashCode = hashCode * 8191 + errorCode;
hashCode = hashCode * 8191 + ((isSetErrorMessage()) ? 131071 : 524287);
if (isSetErrorMessage()) hashCode = hashCode * 8191 + errorMessage.hashCode();
hashCode = hashCode * 8191 + ((isSetDisplayMessage()) ? 131071 : 524287);
if (isSetDisplayMessage()) hashCode = hashCode * 8191 + displayMessage.hashCode();
hashCode = hashCode * 8191 + ((isSetErrorDetailsJson()) ? 131071 : 524287);
if (isSetErrorDetailsJson()) hashCode = hashCode * 8191 + errorDetailsJson.hashCode();
return hashCode;
}
@Override
public int compareTo(TStatus other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.compare(isSetStatusCode(), other.isSetStatusCode());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStatusCode()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.statusCode, other.statusCode);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetInfoMessages(), other.isSetInfoMessages());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetInfoMessages()) {
lastComparison =
org.apache.thrift.TBaseHelper.compareTo(this.infoMessages, other.infoMessages);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetSqlState(), other.isSetSqlState());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSqlState()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sqlState, other.sqlState);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetErrorCode(), other.isSetErrorCode());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetErrorCode()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errorCode, other.errorCode);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetErrorMessage(), other.isSetErrorMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetErrorMessage()) {
lastComparison =
org.apache.thrift.TBaseHelper.compareTo(this.errorMessage, other.errorMessage);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetDisplayMessage(), other.isSetDisplayMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDisplayMessage()) {
lastComparison =
org.apache.thrift.TBaseHelper.compareTo(this.displayMessage, other.displayMessage);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison =
java.lang.Boolean.compare(isSetErrorDetailsJson(), other.isSetErrorDetailsJson());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetErrorDetailsJson()) {
lastComparison =
org.apache.thrift.TBaseHelper.compareTo(this.errorDetailsJson, other.errorDetailsJson);
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("TStatus(");
boolean first = true;
sb.append("statusCode:");
if (this.statusCode == null) {
sb.append("null");
} else {
sb.append(this.statusCode);
}
first = false;
if (isSetInfoMessages()) {
if (!first) sb.append(", ");
sb.append("infoMessages:");
if (this.infoMessages == null) {
sb.append("null");
} else {
sb.append(this.infoMessages);
}
first = false;
}
if (isSetSqlState()) {
if (!first) sb.append(", ");
sb.append("sqlState:");
if (this.sqlState == null) {
sb.append("null");
} else {
sb.append(this.sqlState);
}
first = false;
}
if (isSetErrorCode()) {
if (!first) sb.append(", ");
sb.append("errorCode:");
sb.append(this.errorCode);
first = false;
}
if (isSetErrorMessage()) {
if (!first) sb.append(", ");
sb.append("errorMessage:");
if (this.errorMessage == null) {
sb.append("null");
} else {
sb.append(this.errorMessage);
}
first = false;
}
if (isSetDisplayMessage()) {
if (!first) sb.append(", ");
sb.append("displayMessage:");
if (this.displayMessage == null) {
sb.append("null");
} else {
sb.append(this.displayMessage);
}
first = false;
}
if (isSetErrorDetailsJson()) {
if (!first) sb.append(", ");
sb.append("errorDetailsJson:");
if (this.errorDetailsJson == null) {
sb.append("null");
} else {
sb.append(this.errorDetailsJson);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (statusCode == null) {
throw new org.apache.thrift.protocol.TProtocolException(
"Required field 'statusCode' was not present! 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, 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 TStatusStandardSchemeFactory
implements org.apache.thrift.scheme.SchemeFactory {
@Override
public TStatusStandardScheme getScheme() {
return new TStatusStandardScheme();
}
}
private static class TStatusStandardScheme
extends org.apache.thrift.scheme.StandardScheme {
@Override
public void read(org.apache.thrift.protocol.TProtocol iprot, TStatus 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: // STATUS_CODE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.statusCode =
com.databricks.jdbc.client.impl.thrift.generated.TStatusCode.findByValue(
iprot.readI32());
struct.setStatusCodeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // INFO_MESSAGES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list224 = iprot.readListBegin();
struct.infoMessages = new java.util.ArrayList(_list224.size);
@org.apache.thrift.annotation.Nullable java.lang.String _elem225;
for (int _i226 = 0; _i226 < _list224.size; ++_i226) {
_elem225 = iprot.readString();
struct.infoMessages.add(_elem225);
}
iprot.readListEnd();
}
struct.setInfoMessagesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // SQL_STATE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.sqlState = iprot.readString();
struct.setSqlStateIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // ERROR_CODE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.errorCode = iprot.readI32();
struct.setErrorCodeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // ERROR_MESSAGE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.errorMessage = iprot.readString();
struct.setErrorMessageIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // DISPLAY_MESSAGE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.displayMessage = iprot.readString();
struct.setDisplayMessageIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 1281: // ERROR_DETAILS_JSON
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.errorDetailsJson = iprot.readString();
struct.setErrorDetailsJsonIsSet(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, TStatus struct)
throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.statusCode != null) {
oprot.writeFieldBegin(STATUS_CODE_FIELD_DESC);
oprot.writeI32(struct.statusCode.getValue());
oprot.writeFieldEnd();
}
if (struct.infoMessages != null) {
if (struct.isSetInfoMessages()) {
oprot.writeFieldBegin(INFO_MESSAGES_FIELD_DESC);
{
oprot.writeListBegin(
new org.apache.thrift.protocol.TList(
org.apache.thrift.protocol.TType.STRING, struct.infoMessages.size()));
for (java.lang.String _iter227 : struct.infoMessages) {
oprot.writeString(_iter227);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.sqlState != null) {
if (struct.isSetSqlState()) {
oprot.writeFieldBegin(SQL_STATE_FIELD_DESC);
oprot.writeString(struct.sqlState);
oprot.writeFieldEnd();
}
}
if (struct.isSetErrorCode()) {
oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC);
oprot.writeI32(struct.errorCode);
oprot.writeFieldEnd();
}
if (struct.errorMessage != null) {
if (struct.isSetErrorMessage()) {
oprot.writeFieldBegin(ERROR_MESSAGE_FIELD_DESC);
oprot.writeString(struct.errorMessage);
oprot.writeFieldEnd();
}
}
if (struct.displayMessage != null) {
if (struct.isSetDisplayMessage()) {
oprot.writeFieldBegin(DISPLAY_MESSAGE_FIELD_DESC);
oprot.writeString(struct.displayMessage);
oprot.writeFieldEnd();
}
}
if (struct.errorDetailsJson != null) {
if (struct.isSetErrorDetailsJson()) {
oprot.writeFieldBegin(ERROR_DETAILS_JSON_FIELD_DESC);
oprot.writeString(struct.errorDetailsJson);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TStatusTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
@Override
public TStatusTupleScheme getScheme() {
return new TStatusTupleScheme();
}
}
private static class TStatusTupleScheme extends org.apache.thrift.scheme.TupleScheme {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TStatus struct)
throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot =
(org.apache.thrift.protocol.TTupleProtocol) prot;
oprot.writeI32(struct.statusCode.getValue());
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetInfoMessages()) {
optionals.set(0);
}
if (struct.isSetSqlState()) {
optionals.set(1);
}
if (struct.isSetErrorCode()) {
optionals.set(2);
}
if (struct.isSetErrorMessage()) {
optionals.set(3);
}
if (struct.isSetDisplayMessage()) {
optionals.set(4);
}
if (struct.isSetErrorDetailsJson()) {
optionals.set(5);
}
oprot.writeBitSet(optionals, 6);
if (struct.isSetInfoMessages()) {
{
oprot.writeI32(struct.infoMessages.size());
for (java.lang.String _iter228 : struct.infoMessages) {
oprot.writeString(_iter228);
}
}
}
if (struct.isSetSqlState()) {
oprot.writeString(struct.sqlState);
}
if (struct.isSetErrorCode()) {
oprot.writeI32(struct.errorCode);
}
if (struct.isSetErrorMessage()) {
oprot.writeString(struct.errorMessage);
}
if (struct.isSetDisplayMessage()) {
oprot.writeString(struct.displayMessage);
}
if (struct.isSetErrorDetailsJson()) {
oprot.writeString(struct.errorDetailsJson);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TStatus struct)
throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot =
(org.apache.thrift.protocol.TTupleProtocol) prot;
struct.statusCode =
com.databricks.jdbc.client.impl.thrift.generated.TStatusCode.findByValue(iprot.readI32());
struct.setStatusCodeIsSet(true);
java.util.BitSet incoming = iprot.readBitSet(6);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list229 =
iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
struct.infoMessages = new java.util.ArrayList(_list229.size);
@org.apache.thrift.annotation.Nullable java.lang.String _elem230;
for (int _i231 = 0; _i231 < _list229.size; ++_i231) {
_elem230 = iprot.readString();
struct.infoMessages.add(_elem230);
}
}
struct.setInfoMessagesIsSet(true);
}
if (incoming.get(1)) {
struct.sqlState = iprot.readString();
struct.setSqlStateIsSet(true);
}
if (incoming.get(2)) {
struct.errorCode = iprot.readI32();
struct.setErrorCodeIsSet(true);
}
if (incoming.get(3)) {
struct.errorMessage = iprot.readString();
struct.setErrorMessageIsSet(true);
}
if (incoming.get(4)) {
struct.displayMessage = iprot.readString();
struct.setDisplayMessageIsSet(true);
}
if (incoming.get(5)) {
struct.errorDetailsJson = iprot.readString();
struct.setErrorDetailsJsonIsSet(true);
}
}
}
private static 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();
}
}