/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import java.util.Collections; import java.util.BitSet; import java.util.Arrays; import com.facebook.thrift.*; import com.facebook.thrift.annotations.*; import com.facebook.thrift.async.*; import com.facebook.thrift.meta_data.*; import com.facebook.thrift.server.*; import com.facebook.thrift.transport.*; import com.facebook.thrift.protocol.*; @SuppressWarnings({ "unused", "serial" }) public class reqXcep extends Exception implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("reqXcep"); private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1); private static final TField ERROR_CODE_FIELD_DESC = new TField("errorCode", TType.I32, (short)2); public String message; public int errorCode; public static final int MESSAGE = 1; public static final int ERRORCODE = 2; // isset id assignments private static final int __ERRORCODE_ISSET_ID = 0; private BitSet __isset_bit_vector = new BitSet(1); public static final Map metaDataMap; static { Map tmpMetaDataMap = new HashMap(); tmpMetaDataMap.put(MESSAGE, new FieldMetaData("message", TFieldRequirementType.REQUIRED, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(ERRORCODE, new FieldMetaData("errorCode", TFieldRequirementType.REQUIRED, new FieldValueMetaData(TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap); } static { FieldMetaData.addStructMetaDataMap(reqXcep.class, metaDataMap); } public reqXcep() { } public reqXcep( String message, int errorCode) { this(); this.message = message; this.errorCode = errorCode; setErrorCodeIsSet(true); } public static class Builder { private String message; private int errorCode; BitSet __optional_isset = new BitSet(1); public Builder() { } public Builder setMessage(final String message) { this.message = message; return this; } public Builder setErrorCode(final int errorCode) { this.errorCode = errorCode; __optional_isset.set(__ERRORCODE_ISSET_ID, true); return this; } public reqXcep build() { reqXcep result = new reqXcep(); result.setMessage(this.message); if (__optional_isset.get(__ERRORCODE_ISSET_ID)) { result.setErrorCode(this.errorCode); } return result; } } public static Builder builder() { return new Builder(); } /** * Performs a deep copy on other. */ public reqXcep(reqXcep other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); if (other.isSetMessage()) { this.message = TBaseHelper.deepCopy(other.message); } this.errorCode = TBaseHelper.deepCopy(other.errorCode); } public reqXcep deepCopy() { return new reqXcep(this); } public String getMessage() { return this.message; } public reqXcep setMessage(String message) { this.message = message; return this; } public void unsetMessage() { this.message = null; } // Returns true if field message is set (has been assigned a value) and false otherwise public boolean isSetMessage() { return this.message != null; } public void setMessageIsSet(boolean __value) { if (!__value) { this.message = null; } } public int getErrorCode() { return this.errorCode; } public reqXcep setErrorCode(int errorCode) { this.errorCode = errorCode; setErrorCodeIsSet(true); return this; } public void unsetErrorCode() { __isset_bit_vector.clear(__ERRORCODE_ISSET_ID); } // Returns true if field errorCode is set (has been assigned a value) and false otherwise public boolean isSetErrorCode() { return __isset_bit_vector.get(__ERRORCODE_ISSET_ID); } public void setErrorCodeIsSet(boolean __value) { __isset_bit_vector.set(__ERRORCODE_ISSET_ID, __value); } public void setFieldValue(int fieldID, Object __value) { switch (fieldID) { case MESSAGE: if (__value == null) { unsetMessage(); } else { setMessage((String)__value); } break; case ERRORCODE: if (__value == null) { unsetErrorCode(); } else { setErrorCode((Integer)__value); } break; default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } public Object getFieldValue(int fieldID) { switch (fieldID) { case MESSAGE: return getMessage(); case ERRORCODE: return new Integer(getErrorCode()); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } @Override public boolean equals(Object _that) { if (_that == null) return false; if (this == _that) return true; if (!(_that instanceof reqXcep)) return false; reqXcep that = (reqXcep)_that; if (!TBaseHelper.equalsNobinary(this.isSetMessage(), that.isSetMessage(), this.message, that.message)) { return false; } if (!TBaseHelper.equalsNobinary(this.errorCode, that.errorCode)) { return false; } return true; } @Override public int hashCode() { return Arrays.deepHashCode(new Object[] {message, errorCode}); } public void read(TProtocol iprot) throws TException { TField __field; iprot.readStructBegin(metaDataMap); while (true) { __field = iprot.readFieldBegin(); if (__field.type == TType.STOP) { break; } switch (__field.id) { case MESSAGE: if (__field.type == TType.STRING) { this.message = iprot.readString(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case ERRORCODE: if (__field.type == TType.I32) { this.errorCode = iprot.readI32(); setErrorCodeIsSet(true); } else { TProtocolUtil.skip(iprot, __field.type); } break; default: TProtocolUtil.skip(iprot, __field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method if (!isSetErrorCode()) { throw new TProtocolException("Required field 'errorCode' was not found in serialized data! Struct: " + toString()); } validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.message != null) { oprot.writeFieldBegin(MESSAGE_FIELD_DESC); oprot.writeString(this.message); oprot.writeFieldEnd(); } oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC); oprot.writeI32(this.errorCode); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { return toString(1, true); } @Override public String toString(int indent, boolean prettyPrint) { String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : ""; String newLine = prettyPrint ? "\n" : ""; String space = prettyPrint ? " " : ""; StringBuilder sb = new StringBuilder("reqXcep"); sb.append(space); sb.append("("); sb.append(newLine); boolean first = true; sb.append(indentStr); sb.append("message"); sb.append(space); sb.append(":").append(space); if (this.getMessage() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getMessage(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("errorCode"); sb.append(space); sb.append(":").append(space); sb.append(TBaseHelper.toString(this.getErrorCode(), indent + 1, prettyPrint)); first = false; sb.append(newLine + TBaseHelper.reduceIndent(indentStr)); sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields if (message == null) { throw new TProtocolException(TProtocolException.MISSING_REQUIRED_FIELD, "Required field 'message' was not present! Struct: " + toString()); } // alas, we cannot check 'errorCode' because it's a primitive and you chose the non-beans generator. } }