/** * 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 ExceptionWithStructuredAnnotation extends Exception implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("ExceptionWithStructuredAnnotation"); private static final TField MESSAGE_FIELD_FIELD_DESC = new TField("message_field", TType.STRING, (short)1); private static final TField ERROR_CODE_FIELD_DESC = new TField("error_code", TType.I32, (short)2); public String message_field; public int error_code; public static final int MESSAGE_FIELD = 1; public static final int ERROR_CODE = 2; // isset id assignments private static final int __ERROR_CODE_ISSET_ID = 0; private BitSet __isset_bit_vector = new BitSet(1); public static final Map metaDataMap; static { Map tmpMetaDataMap = new HashMap(); tmpMetaDataMap.put(MESSAGE_FIELD, new FieldMetaData("message_field", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(ERROR_CODE, new FieldMetaData("error_code", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap); } static { FieldMetaData.addStructMetaDataMap(ExceptionWithStructuredAnnotation.class, metaDataMap); } public ExceptionWithStructuredAnnotation() { } public ExceptionWithStructuredAnnotation( String message_field, int error_code) { this(); this.message_field = message_field; this.error_code = error_code; setError_codeIsSet(true); } public static class Builder { private String message_field; private int error_code; BitSet __optional_isset = new BitSet(1); public Builder() { } public Builder setMessage_field(final String message_field) { this.message_field = message_field; return this; } public Builder setError_code(final int error_code) { this.error_code = error_code; __optional_isset.set(__ERROR_CODE_ISSET_ID, true); return this; } public ExceptionWithStructuredAnnotation build() { ExceptionWithStructuredAnnotation result = new ExceptionWithStructuredAnnotation(); result.setMessage_field(this.message_field); if (__optional_isset.get(__ERROR_CODE_ISSET_ID)) { result.setError_code(this.error_code); } return result; } } public static Builder builder() { return new Builder(); } /** * Performs a deep copy on other. */ public ExceptionWithStructuredAnnotation(ExceptionWithStructuredAnnotation other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); if (other.isSetMessage_field()) { this.message_field = TBaseHelper.deepCopy(other.message_field); } this.error_code = TBaseHelper.deepCopy(other.error_code); } public ExceptionWithStructuredAnnotation deepCopy() { return new ExceptionWithStructuredAnnotation(this); } public String getMessage_field() { return this.message_field; } public ExceptionWithStructuredAnnotation setMessage_field(String message_field) { this.message_field = message_field; return this; } public void unsetMessage_field() { this.message_field = null; } // Returns true if field message_field is set (has been assigned a value) and false otherwise public boolean isSetMessage_field() { return this.message_field != null; } public void setMessage_fieldIsSet(boolean __value) { if (!__value) { this.message_field = null; } } public int getError_code() { return this.error_code; } public ExceptionWithStructuredAnnotation setError_code(int error_code) { this.error_code = error_code; setError_codeIsSet(true); return this; } public void unsetError_code() { __isset_bit_vector.clear(__ERROR_CODE_ISSET_ID); } // Returns true if field error_code is set (has been assigned a value) and false otherwise public boolean isSetError_code() { return __isset_bit_vector.get(__ERROR_CODE_ISSET_ID); } public void setError_codeIsSet(boolean __value) { __isset_bit_vector.set(__ERROR_CODE_ISSET_ID, __value); } public void setFieldValue(int fieldID, Object __value) { switch (fieldID) { case MESSAGE_FIELD: if (__value == null) { unsetMessage_field(); } else { setMessage_field((String)__value); } break; case ERROR_CODE: if (__value == null) { unsetError_code(); } else { setError_code((Integer)__value); } break; default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } public Object getFieldValue(int fieldID) { switch (fieldID) { case MESSAGE_FIELD: return getMessage_field(); case ERROR_CODE: return new Integer(getError_code()); 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 ExceptionWithStructuredAnnotation)) return false; ExceptionWithStructuredAnnotation that = (ExceptionWithStructuredAnnotation)_that; if (!TBaseHelper.equalsNobinary(this.isSetMessage_field(), that.isSetMessage_field(), this.message_field, that.message_field)) { return false; } if (!TBaseHelper.equalsNobinary(this.error_code, that.error_code)) { return false; } return true; } @Override public int hashCode() { return Arrays.deepHashCode(new Object[] {message_field, error_code}); } 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_FIELD: if (__field.type == TType.STRING) { this.message_field = iprot.readString(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case ERROR_CODE: if (__field.type == TType.I32) { this.error_code = iprot.readI32(); setError_codeIsSet(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 validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.message_field != null) { oprot.writeFieldBegin(MESSAGE_FIELD_FIELD_DESC); oprot.writeString(this.message_field); oprot.writeFieldEnd(); } oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC); oprot.writeI32(this.error_code); 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("ExceptionWithStructuredAnnotation"); sb.append(space); sb.append("("); sb.append(newLine); boolean first = true; sb.append(indentStr); sb.append("message_field"); sb.append(space); sb.append(":").append(space); if (this.getMessage_field() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getMessage_field(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("error_code"); sb.append(space); sb.append(":").append(space); sb.append(TBaseHelper.toString(this.getError_code(), 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 } }