/** * 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 StructWithSharedConst implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("StructWithSharedConst"); private static final TField OPT_SHARED_CONST_FIELD_DESC = new TField("opt_shared_const", TType.STRUCT, (short)1); private static final TField SHARED_CONST_FIELD_DESC = new TField("shared_const", TType.STRUCT, (short)2); private static final TField REQ_SHARED_CONST_FIELD_DESC = new TField("req_shared_const", TType.STRUCT, (short)3); public final MyField opt_shared_const; public final MyField shared_const; public final MyField req_shared_const; public static final int OPT_SHARED_CONST = 1; public static final int SHARED_CONST = 2; public static final int REQ_SHARED_CONST = 3; public StructWithSharedConst( MyField opt_shared_const, MyField shared_const, MyField req_shared_const) { this.opt_shared_const = opt_shared_const; this.shared_const = shared_const; this.req_shared_const = req_shared_const; } /** * Performs a deep copy on other. */ public StructWithSharedConst(StructWithSharedConst other) { if (other.isSetOpt_shared_const()) { this.opt_shared_const = TBaseHelper.deepCopy(other.opt_shared_const); } else { this.opt_shared_const = null; } if (other.isSetShared_const()) { this.shared_const = TBaseHelper.deepCopy(other.shared_const); } else { this.shared_const = null; } if (other.isSetReq_shared_const()) { this.req_shared_const = TBaseHelper.deepCopy(other.req_shared_const); } else { this.req_shared_const = null; } } public StructWithSharedConst deepCopy() { return new StructWithSharedConst(this); } public MyField getOpt_shared_const() { return this.opt_shared_const; } // Returns true if field opt_shared_const is set (has been assigned a value) and false otherwise public boolean isSetOpt_shared_const() { return this.opt_shared_const != null; } public MyField getShared_const() { return this.shared_const; } // Returns true if field shared_const is set (has been assigned a value) and false otherwise public boolean isSetShared_const() { return this.shared_const != null; } public MyField getReq_shared_const() { return this.req_shared_const; } // Returns true if field req_shared_const is set (has been assigned a value) and false otherwise public boolean isSetReq_shared_const() { return this.req_shared_const != null; } @Override public boolean equals(Object _that) { if (_that == null) return false; if (this == _that) return true; if (!(_that instanceof StructWithSharedConst)) return false; StructWithSharedConst that = (StructWithSharedConst)_that; if (!TBaseHelper.equalsNobinary(this.isSetOpt_shared_const(), that.isSetOpt_shared_const(), this.opt_shared_const, that.opt_shared_const)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetShared_const(), that.isSetShared_const(), this.shared_const, that.shared_const)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetReq_shared_const(), that.isSetReq_shared_const(), this.req_shared_const, that.req_shared_const)) { return false; } return true; } @Override public int hashCode() { return Arrays.deepHashCode(new Object[] {opt_shared_const, shared_const, req_shared_const}); } // This is required to satisfy the TBase interface, but can't be implemented on immutable struture. public void read(TProtocol iprot) throws TException { throw new TException("unimplemented in android immutable structure"); } public static StructWithSharedConst deserialize(TProtocol iprot) throws TException { MyField tmp_opt_shared_const = null; MyField tmp_shared_const = null; MyField tmp_req_shared_const = null; TField __field; iprot.readStructBegin(); while (true) { __field = iprot.readFieldBegin(); if (__field.type == TType.STOP) { break; } switch (__field.id) { case OPT_SHARED_CONST: if (__field.type == TType.STRUCT) { tmp_opt_shared_const = MyField.deserialize(iprot); } else { TProtocolUtil.skip(iprot, __field.type); } break; case SHARED_CONST: if (__field.type == TType.STRUCT) { tmp_shared_const = MyField.deserialize(iprot); } else { TProtocolUtil.skip(iprot, __field.type); } break; case REQ_SHARED_CONST: if (__field.type == TType.STRUCT) { tmp_req_shared_const = MyField.deserialize(iprot); } else { TProtocolUtil.skip(iprot, __field.type); } break; default: TProtocolUtil.skip(iprot, __field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); StructWithSharedConst _that; _that = new StructWithSharedConst( tmp_opt_shared_const ,tmp_shared_const ,tmp_req_shared_const ); _that.validate(); return _that; } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.opt_shared_const != null) { if (isSetOpt_shared_const()) { oprot.writeFieldBegin(OPT_SHARED_CONST_FIELD_DESC); this.opt_shared_const.write(oprot); oprot.writeFieldEnd(); } } if (this.shared_const != null) { oprot.writeFieldBegin(SHARED_CONST_FIELD_DESC); this.shared_const.write(oprot); oprot.writeFieldEnd(); } if (this.req_shared_const != null) { oprot.writeFieldBegin(REQ_SHARED_CONST_FIELD_DESC); this.req_shared_const.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { return toString(1, true); } @Override public String toString(int indent, boolean prettyPrint) { return TBaseHelper.toStringHelper(this, indent, prettyPrint); } public void validate() throws TException { // check for required fields if (req_shared_const == null) { throw new TProtocolException(TProtocolException.MISSING_REQUIRED_FIELD, "Required field 'req_shared_const' was not present! Struct: " + toString()); } } }