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" })
25 public class Serious extends Exception implements TBase, java.io.Serializable, Cloneable {
26   private static final TStruct STRUCT_DESC = new TStruct("Serious");
27   private static final TField SONNET_FIELD_DESC = new TField("sonnet", TType.STRING, (short)1);
28 
29   public String sonnet;
30   public static final int SONNET = 1;
31 
32   // isset id assignments
33 
34   public static final Map<Integer, FieldMetaData> metaDataMap;
35 
36   static {
37     Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
tmpMetaDataMap.put(SONNET, new FieldMetaData(R, TFieldRequirementType.OPTIONAL, new FieldValueMetaData(TType.STRING)))38     tmpMetaDataMap.put(SONNET, new FieldMetaData("sonnet", TFieldRequirementType.OPTIONAL,
39         new FieldValueMetaData(TType.STRING)));
40     metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
41   }
42 
43   static {
FieldMetaData.addStructMetaDataMap(Serious.class, metaDataMap)44     FieldMetaData.addStructMetaDataMap(Serious.class, metaDataMap);
45   }
46 
Serious()47   public Serious() {
48   }
49 
Serious( String sonnet)50   public Serious(
51       String sonnet) {
52     this();
53     this.sonnet = sonnet;
54   }
55 
56   public static class Builder {
57     private String sonnet;
58 
Builder()59     public Builder() {
60     }
61 
setSonnet(final String sonnet)62     public Builder setSonnet(final String sonnet) {
63       this.sonnet = sonnet;
64       return this;
65     }
66 
build()67     public Serious build() {
68       Serious result = new Serious();
69       result.setSonnet(this.sonnet);
70       return result;
71     }
72   }
73 
builder()74   public static Builder builder() {
75     return new Builder();
76   }
77 
78   /**
79    * Performs a deep copy on <i>other</i>.
80    */
Serious(Serious other)81   public Serious(Serious other) {
82     if (other.isSetSonnet()) {
83       this.sonnet = TBaseHelper.deepCopy(other.sonnet);
84     }
85   }
86 
deepCopy()87   public Serious deepCopy() {
88     return new Serious(this);
89   }
90 
getSonnet()91   public String getSonnet() {
92     return this.sonnet;
93   }
94 
setSonnet(String sonnet)95   public Serious setSonnet(String sonnet) {
96     this.sonnet = sonnet;
97     return this;
98   }
99 
unsetSonnet()100   public void unsetSonnet() {
101     this.sonnet = null;
102   }
103 
104   // Returns true if field sonnet is set (has been assigned a value) and false otherwise
isSetSonnet()105   public boolean isSetSonnet() {
106     return this.sonnet != null;
107   }
108 
setSonnetIsSet(boolean __value)109   public void setSonnetIsSet(boolean __value) {
110     if (!__value) {
111       this.sonnet = null;
112     }
113   }
114 
setFieldValue(int fieldID, Object __value)115   public void setFieldValue(int fieldID, Object __value) {
116     switch (fieldID) {
117     case SONNET:
118       if (__value == null) {
119         unsetSonnet();
120       } else {
121         setSonnet((String)__value);
122       }
123       break;
124 
125     default:
126       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
127     }
128   }
129 
getFieldValue(int fieldID)130   public Object getFieldValue(int fieldID) {
131     switch (fieldID) {
132     case SONNET:
133       return getSonnet();
134 
135     default:
136       throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
137     }
138   }
139 
140   @Override
equals(Object _that)141   public boolean equals(Object _that) {
142     if (_that == null)
143       return false;
144     if (this == _that)
145       return true;
146     if (!(_that instanceof Serious))
147       return false;
148     Serious that = (Serious)_that;
149 
150     if (!TBaseHelper.equalsNobinary(this.isSetSonnet(), that.isSetSonnet(), this.sonnet, that.sonnet)) { return false; }
151 
152     return true;
153   }
154 
155   @Override
hashCode()156   public int hashCode() {
157     return Arrays.deepHashCode(new Object[] {sonnet});
158   }
159 
read(TProtocol iprot)160   public void read(TProtocol iprot) throws TException {
161     TField __field;
162     iprot.readStructBegin(metaDataMap);
163     while (true)
164     {
165       __field = iprot.readFieldBegin();
166       if (__field.type == TType.STOP) {
167         break;
168       }
169       switch (__field.id)
170       {
171         case SONNET:
172           if (__field.type == TType.STRING) {
173             this.sonnet = iprot.readString();
174           } else {
175             TProtocolUtil.skip(iprot, __field.type);
176           }
177           break;
178         default:
179           TProtocolUtil.skip(iprot, __field.type);
180           break;
181       }
182       iprot.readFieldEnd();
183     }
184     iprot.readStructEnd();
185 
186 
187     // check for required fields of primitive type, which can't be checked in the validate method
188     validate();
189   }
190 
write(TProtocol oprot)191   public void write(TProtocol oprot) throws TException {
192     validate();
193 
194     oprot.writeStructBegin(STRUCT_DESC);
195     if (this.sonnet != null) {
196       if (isSetSonnet()) {
197         oprot.writeFieldBegin(SONNET_FIELD_DESC);
198         oprot.writeString(this.sonnet);
199         oprot.writeFieldEnd();
200       }
201     }
202     oprot.writeFieldStop();
203     oprot.writeStructEnd();
204   }
205 
206   @Override
toString()207   public String toString() {
208     return toString(1, true);
209   }
210 
211   @Override
toString(int indent, boolean prettyPrint)212   public String toString(int indent, boolean prettyPrint) {
213     String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
214     String newLine = prettyPrint ? "\n" : "";
215     String space = prettyPrint ? " " : "";
216     StringBuilder sb = new StringBuilder("Serious");
217     sb.append(space);
218     sb.append("(");
219     sb.append(newLine);
220     boolean first = true;
221 
222     if (isSetSonnet())
223     {
224       sb.append(indentStr);
225       sb.append("sonnet");
226       sb.append(space);
227       sb.append(":").append(space);
228       if (this.getSonnet() == null) {
229         sb.append("null");
230       } else {
231         sb.append(TBaseHelper.toString(this.getSonnet(), indent + 1, prettyPrint));
232       }
233       first = false;
234     }
235     sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
236     sb.append(")");
237     return sb.toString();
238   }
239 
validate()240   public void validate() throws TException {
241     // check for required fields
242   }
243 
244 }
245 
246