1 /**
2  * Autogenerated by Thrift
3  *
4  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5  *  @generated
6  */
7 import java.util.List;
8 import java.util.ArrayList;
9 import java.util.Map;
10 import java.util.HashMap;
11 import java.util.Set;
12 import java.util.HashSet;
13 import java.util.Collections;
14 import java.util.BitSet;
15 import java.util.Arrays;
16 import com.facebook.thrift.*;
17 import com.facebook.thrift.annotations.*;
18 import com.facebook.thrift.async.*;
19 import com.facebook.thrift.meta_data.*;
20 import com.facebook.thrift.server.*;
21 import com.facebook.thrift.transport.*;
22 import com.facebook.thrift.protocol.*;
23 
24 @SuppressWarnings({ "unused", "serial", "unchecked" })
25 public class Nada extends TUnion<Nada> implements Comparable<Nada> {
26   private static final TStruct STRUCT_DESC = new TStruct("Nada");
27 
28 
29   public static final Map<Integer, FieldMetaData> metaDataMap;
30 
31   static {
32     Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
33     metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
34   }
35 
Nada()36   public Nada() {
37     super();
38   }
39 
Nada(int setField, Object __value)40   public Nada(int setField, Object __value) {
41     super(setField, __value);
42   }
43 
Nada(Nada other)44   public Nada(Nada other) {
45     super(other);
46   }
47 
deepCopy()48   public Nada deepCopy() {
49     return new Nada(this);
50   }
51 
52 
53   @Override
checkType(short setField, Object __value)54   protected void checkType(short setField, Object __value) throws ClassCastException {
55     switch (setField) {
56       default:
57         throw new IllegalArgumentException("Unknown field id " + setField);
58     }
59   }
60 
61   @Override
read(TProtocol iprot)62   public void read(TProtocol iprot) throws TException {
63     setField_ = 0;
64     value_ = null;
65     iprot.readStructBegin(metaDataMap);
66     TField __field = iprot.readFieldBegin();
67     if (__field.type != TType.STOP)
68     {
69       value_ = readValue(iprot, __field);
70       if (value_ != null)
71       {
72         switch (__field.id) {
73         }
74       }
75       iprot.readFieldEnd();
76       TField __stopField = iprot.readFieldBegin();
77       if (__stopField.type != TType.STOP) {
78         throw new TProtocolException(TProtocolException.INVALID_DATA, "Union 'Nada' is missing a STOP byte");
79       }
80     }
81     iprot.readStructEnd();
82   }
83 
84   @Override
readValue(TProtocol iprot, TField __field)85   protected Object readValue(TProtocol iprot, TField __field) throws TException {
86     switch (__field.id) {
87     }
88     TProtocolUtil.skip(iprot, __field.type);
89     return null;
90   }
91 
92   @Override
writeValue(TProtocol oprot, short setField, Object __value)93   protected void writeValue(TProtocol oprot, short setField, Object __value) throws TException {
94     switch (setField) {
95       default:
96         throw new IllegalStateException("Cannot write union with unknown field " + setField);
97     }
98   }
99 
100   @Override
getFieldDesc(int setField)101   protected TField getFieldDesc(int setField) {
102     switch (setField) {
103       default:
104         throw new IllegalArgumentException("Unknown field id " + setField);
105     }
106   }
107 
108   @Override
getStructDesc()109   protected TStruct getStructDesc() {
110     return STRUCT_DESC;
111   }
112 
113   @Override
getMetaDataMap()114   protected Map<Integer, FieldMetaData> getMetaDataMap() { return metaDataMap; }
115 
__getValue(int expectedFieldId)116   private Object __getValue(int expectedFieldId) {
117     if (getSetField() == expectedFieldId) {
118       return getFieldValue();
119     } else {
120       throw new RuntimeException("Cannot get field '" + getFieldDesc(expectedFieldId).name + "' because union is currently set to " + getFieldDesc(getSetField()).name);
121     }
122   }
123 
__setValue(int fieldId, Object __value)124   private void __setValue(int fieldId, Object __value) {
125     if (__value == null) throw new NullPointerException();
126     setField_ = fieldId;
127     value_ = __value;
128   }
129 
130 
equals(Object other)131   public boolean equals(Object other) {
132     if (other instanceof Nada) {
133       return equals((Nada)other);
134     } else {
135       return false;
136     }
137   }
138 
equals(Nada other)139   public boolean equals(Nada other) {
140     return equalsNobinaryImpl(other);
141   }
142 
143   @Override
compareTo(Nada other)144   public int compareTo(Nada other) {
145     return compareToImpl(other);
146   }
147 
148 
149   @Override
hashCode()150   public int hashCode() {
151     return Arrays.deepHashCode(new Object[] {getSetField(), getFieldValue()});
152   }
153 
154 }
155