/** * 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 StructWithUnion implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("StructWithUnion"); private static final TField U_FIELD_DESC = new TField("u", TType.STRUCT, (short)1); private static final TField A_DOUBLE_FIELD_DESC = new TField("aDouble", TType.DOUBLE, (short)2); private static final TField F_FIELD_DESC = new TField("f", TType.STRUCT, (short)3); public final MyUnion u; public final Double aDouble; public final MyField f; public static final int U = 1; public static final int ADOUBLE = 2; public static final int F = 3; public StructWithUnion( MyUnion u, Double aDouble, MyField f) { this.u = u; this.aDouble = aDouble; this.f = f; } /** * Performs a deep copy on other. */ public StructWithUnion(StructWithUnion other) { if (other.isSetU()) { this.u = TBaseHelper.deepCopy(other.u); } else { this.u = null; } if (other.isSetADouble()) { this.aDouble = TBaseHelper.deepCopy(other.aDouble); } else { this.aDouble = null; } if (other.isSetF()) { this.f = TBaseHelper.deepCopy(other.f); } else { this.f = null; } } public StructWithUnion deepCopy() { return new StructWithUnion(this); } public MyUnion getU() { return this.u; } // Returns true if field u is set (has been assigned a value) and false otherwise public boolean isSetU() { return this.u != null; } public Double getADouble() { return this.aDouble; } // Returns true if field aDouble is set (has been assigned a value) and false otherwise public boolean isSetADouble() { return this.aDouble != null; } public MyField getF() { return this.f; } // Returns true if field f is set (has been assigned a value) and false otherwise public boolean isSetF() { return this.f != null; } @Override public boolean equals(Object _that) { if (_that == null) return false; if (this == _that) return true; if (!(_that instanceof StructWithUnion)) return false; StructWithUnion that = (StructWithUnion)_that; if (!TBaseHelper.equalsNobinary(this.isSetU(), that.isSetU(), this.u, that.u)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetADouble(), that.isSetADouble(), this.aDouble, that.aDouble)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetF(), that.isSetF(), this.f, that.f)) { return false; } return true; } @Override public int hashCode() { return Arrays.deepHashCode(new Object[] {u, aDouble, f}); } // 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 StructWithUnion deserialize(TProtocol iprot) throws TException { MyUnion tmp_u = null; Double tmp_aDouble = null; MyField tmp_f = null; TField __field; iprot.readStructBegin(); while (true) { __field = iprot.readFieldBegin(); if (__field.type == TType.STOP) { break; } switch (__field.id) { case U: if (__field.type == TType.STRUCT) { tmp_u = new MyUnion(); tmp_u.read(iprot); } else { TProtocolUtil.skip(iprot, __field.type); } break; case ADOUBLE: if (__field.type == TType.DOUBLE) { tmp_aDouble = iprot.readDouble(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case F: if (__field.type == TType.STRUCT) { tmp_f = MyField.deserialize(iprot); } else { TProtocolUtil.skip(iprot, __field.type); } break; default: TProtocolUtil.skip(iprot, __field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); StructWithUnion _that; _that = new StructWithUnion( tmp_u ,tmp_aDouble ,tmp_f ); _that.validate(); return _that; } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.u != null) { oprot.writeFieldBegin(U_FIELD_DESC); this.u.write(oprot); oprot.writeFieldEnd(); } if (this.aDouble != null) { oprot.writeFieldBegin(A_DOUBLE_FIELD_DESC); oprot.writeDouble(this.aDouble); oprot.writeFieldEnd(); } if (this.f != null) { oprot.writeFieldBegin(F_FIELD_DESC); this.f.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 } }