View Javadoc

1   /**
2    * Autogenerated by Thrift Compiler (0.7.0)
3    *
4    * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5    */
6   package org.apache.hadoop.hbase.thrift.generated;
7   
8   import java.util.List;
9   import java.util.ArrayList;
10  import java.util.Map;
11  import java.util.HashMap;
12  import java.util.EnumMap;
13  import java.util.Set;
14  import java.util.HashSet;
15  import java.util.EnumSet;
16  import java.util.Collections;
17  import java.util.BitSet;
18  import java.nio.ByteBuffer;
19  import java.util.Arrays;
20  import org.slf4j.Logger;
21  import org.slf4j.LoggerFactory;
22  
23  /**
24   * An IllegalArgument exception indicates an illegal or invalid
25   * argument was passed into a procedure.
26   */
27  public class IllegalArgument extends Exception implements org.apache.thrift.TBase<IllegalArgument, IllegalArgument._Fields>, java.io.Serializable, Cloneable {
28    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IllegalArgument");
29  
30    private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
31  
32    public String message; // required
33  
34    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
35    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
36      MESSAGE((short)1, "message");
37  
38      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
39  
40      static {
41        for (_Fields field : EnumSet.allOf(_Fields.class)) {
42          byName.put(field.getFieldName(), field);
43        }
44      }
45  
46      /**
47       * Find the _Fields constant that matches fieldId, or null if its not found.
48       */
49      public static _Fields findByThriftId(int fieldId) {
50        switch(fieldId) {
51          case 1: // MESSAGE
52            return MESSAGE;
53          default:
54            return null;
55        }
56      }
57  
58      /**
59       * Find the _Fields constant that matches fieldId, throwing an exception
60       * if it is not found.
61       */
62      public static _Fields findByThriftIdOrThrow(int fieldId) {
63        _Fields fields = findByThriftId(fieldId);
64        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
65        return fields;
66      }
67  
68      /**
69       * Find the _Fields constant that matches name, or null if its not found.
70       */
71      public static _Fields findByName(String name) {
72        return byName.get(name);
73      }
74  
75      private final short _thriftId;
76      private final String _fieldName;
77  
78      _Fields(short thriftId, String fieldName) {
79        _thriftId = thriftId;
80        _fieldName = fieldName;
81      }
82  
83      public short getThriftFieldId() {
84        return _thriftId;
85      }
86  
87      public String getFieldName() {
88        return _fieldName;
89      }
90    }
91  
92    // isset id assignments
93  
94    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
95    static {
96      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
97      tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, 
98          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
99      metaDataMap = Collections.unmodifiableMap(tmpMap);
100     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IllegalArgument.class, metaDataMap);
101   }
102 
103   public IllegalArgument() {
104   }
105 
106   public IllegalArgument(
107     String message)
108   {
109     this();
110     this.message = message;
111   }
112 
113   /**
114    * Performs a deep copy on <i>other</i>.
115    */
116   public IllegalArgument(IllegalArgument other) {
117     if (other.isSetMessage()) {
118       this.message = other.message;
119     }
120   }
121 
122   public IllegalArgument deepCopy() {
123     return new IllegalArgument(this);
124   }
125 
126   @Override
127   public void clear() {
128     this.message = null;
129   }
130 
131   public String getMessage() {
132     return this.message;
133   }
134 
135   public IllegalArgument setMessage(String message) {
136     this.message = message;
137     return this;
138   }
139 
140   public void unsetMessage() {
141     this.message = null;
142   }
143 
144   /** Returns true if field message is set (has been assigned a value) and false otherwise */
145   public boolean isSetMessage() {
146     return this.message != null;
147   }
148 
149   public void setMessageIsSet(boolean value) {
150     if (!value) {
151       this.message = null;
152     }
153   }
154 
155   public void setFieldValue(_Fields field, Object value) {
156     switch (field) {
157     case MESSAGE:
158       if (value == null) {
159         unsetMessage();
160       } else {
161         setMessage((String)value);
162       }
163       break;
164 
165     }
166   }
167 
168   public Object getFieldValue(_Fields field) {
169     switch (field) {
170     case MESSAGE:
171       return getMessage();
172 
173     }
174     throw new IllegalStateException();
175   }
176 
177   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
178   public boolean isSet(_Fields field) {
179     if (field == null) {
180       throw new IllegalArgumentException();
181     }
182 
183     switch (field) {
184     case MESSAGE:
185       return isSetMessage();
186     }
187     throw new IllegalStateException();
188   }
189 
190   @Override
191   public boolean equals(Object that) {
192     if (that == null)
193       return false;
194     if (that instanceof IllegalArgument)
195       return this.equals((IllegalArgument)that);
196     return false;
197   }
198 
199   public boolean equals(IllegalArgument that) {
200     if (that == null)
201       return false;
202 
203     boolean this_present_message = true && this.isSetMessage();
204     boolean that_present_message = true && that.isSetMessage();
205     if (this_present_message || that_present_message) {
206       if (!(this_present_message && that_present_message))
207         return false;
208       if (!this.message.equals(that.message))
209         return false;
210     }
211 
212     return true;
213   }
214 
215   @Override
216   public int hashCode() {
217     return 0;
218   }
219 
220   public int compareTo(IllegalArgument other) {
221     if (!getClass().equals(other.getClass())) {
222       return getClass().getName().compareTo(other.getClass().getName());
223     }
224 
225     int lastComparison = 0;
226     IllegalArgument typedOther = (IllegalArgument)other;
227 
228     lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
229     if (lastComparison != 0) {
230       return lastComparison;
231     }
232     if (isSetMessage()) {
233       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
234       if (lastComparison != 0) {
235         return lastComparison;
236       }
237     }
238     return 0;
239   }
240 
241   public _Fields fieldForId(int fieldId) {
242     return _Fields.findByThriftId(fieldId);
243   }
244 
245   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
246     org.apache.thrift.protocol.TField field;
247     iprot.readStructBegin();
248     while (true)
249     {
250       field = iprot.readFieldBegin();
251       if (field.type == org.apache.thrift.protocol.TType.STOP) { 
252         break;
253       }
254       switch (field.id) {
255         case 1: // MESSAGE
256           if (field.type == org.apache.thrift.protocol.TType.STRING) {
257             this.message = iprot.readString();
258           } else { 
259             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
260           }
261           break;
262         default:
263           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
264       }
265       iprot.readFieldEnd();
266     }
267     iprot.readStructEnd();
268 
269     // check for required fields of primitive type, which can't be checked in the validate method
270     validate();
271   }
272 
273   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
274     validate();
275 
276     oprot.writeStructBegin(STRUCT_DESC);
277     if (this.message != null) {
278       oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
279       oprot.writeString(this.message);
280       oprot.writeFieldEnd();
281     }
282     oprot.writeFieldStop();
283     oprot.writeStructEnd();
284   }
285 
286   @Override
287   public String toString() {
288     StringBuilder sb = new StringBuilder("IllegalArgument(");
289     boolean first = true;
290 
291     sb.append("message:");
292     if (this.message == null) {
293       sb.append("null");
294     } else {
295       sb.append(this.message);
296     }
297     first = false;
298     sb.append(")");
299     return sb.toString();
300   }
301 
302   public void validate() throws org.apache.thrift.TException {
303     // check for required fields
304   }
305 
306   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
307     try {
308       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
309     } catch (org.apache.thrift.TException te) {
310       throw new java.io.IOException(te);
311     }
312   }
313 
314   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
315     try {
316       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
317     } catch (org.apache.thrift.TException te) {
318       throw new java.io.IOException(te);
319     }
320   }
321 
322 }
323