001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.io.watcher.common;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroFailure extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -2860978459977489277L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroFailure\",\"namespace\":\"org.apache.reef.io.watcher.common\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"message\",\"type\":\"string\"},{\"name\":\"description\",\"type\":[\"string\",\"null\"]},{\"name\":\"reason\",\"type\":[\"string\",\"null\"]},{\"name\":\"data\",\"type\":[\"bytes\",\"null\"]},{\"name\":\"asError\",\"type\":\"string\"}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.lang.CharSequence id;
017  @Deprecated public java.lang.CharSequence message;
018  @Deprecated public java.lang.CharSequence description;
019  @Deprecated public java.lang.CharSequence reason;
020  @Deprecated public java.nio.ByteBuffer data;
021  @Deprecated public java.lang.CharSequence asError;
022
023  /**
024   * Default constructor.  Note that this does not initialize fields
025   * to their default values from the schema.  If that is desired then
026   * one should use <code>newBuilder()</code>.
027   */
028  public AvroFailure() {}
029
030  /**
031   * All-args constructor.
032   * @param id The new value for id
033   * @param message The new value for message
034   * @param description The new value for description
035   * @param reason The new value for reason
036   * @param data The new value for data
037   * @param asError The new value for asError
038   */
039  public AvroFailure(java.lang.CharSequence id, java.lang.CharSequence message, java.lang.CharSequence description, java.lang.CharSequence reason, java.nio.ByteBuffer data, java.lang.CharSequence asError) {
040    this.id = id;
041    this.message = message;
042    this.description = description;
043    this.reason = reason;
044    this.data = data;
045    this.asError = asError;
046  }
047
048  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
049  // Used by DatumWriter.  Applications should not call.
050  public java.lang.Object get(int field$) {
051    switch (field$) {
052    case 0: return id;
053    case 1: return message;
054    case 2: return description;
055    case 3: return reason;
056    case 4: return data;
057    case 5: return asError;
058    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
059    }
060  }
061
062  // Used by DatumReader.  Applications should not call.
063  @SuppressWarnings(value="unchecked")
064  public void put(int field$, java.lang.Object value$) {
065    switch (field$) {
066    case 0: id = (java.lang.CharSequence)value$; break;
067    case 1: message = (java.lang.CharSequence)value$; break;
068    case 2: description = (java.lang.CharSequence)value$; break;
069    case 3: reason = (java.lang.CharSequence)value$; break;
070    case 4: data = (java.nio.ByteBuffer)value$; break;
071    case 5: asError = (java.lang.CharSequence)value$; break;
072    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
073    }
074  }
075
076  /**
077   * Gets the value of the 'id' field.
078   * @return The value of the 'id' field.
079   */
080  public java.lang.CharSequence getId() {
081    return id;
082  }
083
084  /**
085   * Sets the value of the 'id' field.
086   * @param value the value to set.
087   */
088  public void setId(java.lang.CharSequence value) {
089    this.id = value;
090  }
091
092  /**
093   * Gets the value of the 'message' field.
094   * @return The value of the 'message' field.
095   */
096  public java.lang.CharSequence getMessage() {
097    return message;
098  }
099
100  /**
101   * Sets the value of the 'message' field.
102   * @param value the value to set.
103   */
104  public void setMessage(java.lang.CharSequence value) {
105    this.message = value;
106  }
107
108  /**
109   * Gets the value of the 'description' field.
110   * @return The value of the 'description' field.
111   */
112  public java.lang.CharSequence getDescription() {
113    return description;
114  }
115
116  /**
117   * Sets the value of the 'description' field.
118   * @param value the value to set.
119   */
120  public void setDescription(java.lang.CharSequence value) {
121    this.description = value;
122  }
123
124  /**
125   * Gets the value of the 'reason' field.
126   * @return The value of the 'reason' field.
127   */
128  public java.lang.CharSequence getReason() {
129    return reason;
130  }
131
132  /**
133   * Sets the value of the 'reason' field.
134   * @param value the value to set.
135   */
136  public void setReason(java.lang.CharSequence value) {
137    this.reason = value;
138  }
139
140  /**
141   * Gets the value of the 'data' field.
142   * @return The value of the 'data' field.
143   */
144  public java.nio.ByteBuffer getData() {
145    return data;
146  }
147
148  /**
149   * Sets the value of the 'data' field.
150   * @param value the value to set.
151   */
152  public void setData(java.nio.ByteBuffer value) {
153    this.data = value;
154  }
155
156  /**
157   * Gets the value of the 'asError' field.
158   * @return The value of the 'asError' field.
159   */
160  public java.lang.CharSequence getAsError() {
161    return asError;
162  }
163
164  /**
165   * Sets the value of the 'asError' field.
166   * @param value the value to set.
167   */
168  public void setAsError(java.lang.CharSequence value) {
169    this.asError = value;
170  }
171
172  /**
173   * Creates a new AvroFailure RecordBuilder.
174   * @return A new AvroFailure RecordBuilder
175   */
176  public static org.apache.reef.io.watcher.common.AvroFailure.Builder newBuilder() {
177    return new org.apache.reef.io.watcher.common.AvroFailure.Builder();
178  }
179
180  /**
181   * Creates a new AvroFailure RecordBuilder by copying an existing Builder.
182   * @param other The existing builder to copy.
183   * @return A new AvroFailure RecordBuilder
184   */
185  public static org.apache.reef.io.watcher.common.AvroFailure.Builder newBuilder(org.apache.reef.io.watcher.common.AvroFailure.Builder other) {
186    return new org.apache.reef.io.watcher.common.AvroFailure.Builder(other);
187  }
188
189  /**
190   * Creates a new AvroFailure RecordBuilder by copying an existing AvroFailure instance.
191   * @param other The existing instance to copy.
192   * @return A new AvroFailure RecordBuilder
193   */
194  public static org.apache.reef.io.watcher.common.AvroFailure.Builder newBuilder(org.apache.reef.io.watcher.common.AvroFailure other) {
195    return new org.apache.reef.io.watcher.common.AvroFailure.Builder(other);
196  }
197
198  /**
199   * RecordBuilder for AvroFailure instances.
200   */
201  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroFailure>
202    implements org.apache.avro.data.RecordBuilder<AvroFailure> {
203
204    private java.lang.CharSequence id;
205    private java.lang.CharSequence message;
206    private java.lang.CharSequence description;
207    private java.lang.CharSequence reason;
208    private java.nio.ByteBuffer data;
209    private java.lang.CharSequence asError;
210
211    /** Creates a new Builder */
212    private Builder() {
213      super(SCHEMA$);
214    }
215
216    /**
217     * Creates a Builder by copying an existing Builder.
218     * @param other The existing Builder to copy.
219     */
220    private Builder(org.apache.reef.io.watcher.common.AvroFailure.Builder other) {
221      super(other);
222      if (isValidValue(fields()[0], other.id)) {
223        this.id = data().deepCopy(fields()[0].schema(), other.id);
224        fieldSetFlags()[0] = true;
225      }
226      if (isValidValue(fields()[1], other.message)) {
227        this.message = data().deepCopy(fields()[1].schema(), other.message);
228        fieldSetFlags()[1] = true;
229      }
230      if (isValidValue(fields()[2], other.description)) {
231        this.description = data().deepCopy(fields()[2].schema(), other.description);
232        fieldSetFlags()[2] = true;
233      }
234      if (isValidValue(fields()[3], other.reason)) {
235        this.reason = data().deepCopy(fields()[3].schema(), other.reason);
236        fieldSetFlags()[3] = true;
237      }
238      if (isValidValue(fields()[4], other.data)) {
239        this.data = data().deepCopy(fields()[4].schema(), other.data);
240        fieldSetFlags()[4] = true;
241      }
242      if (isValidValue(fields()[5], other.asError)) {
243        this.asError = data().deepCopy(fields()[5].schema(), other.asError);
244        fieldSetFlags()[5] = true;
245      }
246    }
247
248    /**
249     * Creates a Builder by copying an existing AvroFailure instance
250     * @param other The existing instance to copy.
251     */
252    private Builder(org.apache.reef.io.watcher.common.AvroFailure other) {
253            super(SCHEMA$);
254      if (isValidValue(fields()[0], other.id)) {
255        this.id = data().deepCopy(fields()[0].schema(), other.id);
256        fieldSetFlags()[0] = true;
257      }
258      if (isValidValue(fields()[1], other.message)) {
259        this.message = data().deepCopy(fields()[1].schema(), other.message);
260        fieldSetFlags()[1] = true;
261      }
262      if (isValidValue(fields()[2], other.description)) {
263        this.description = data().deepCopy(fields()[2].schema(), other.description);
264        fieldSetFlags()[2] = true;
265      }
266      if (isValidValue(fields()[3], other.reason)) {
267        this.reason = data().deepCopy(fields()[3].schema(), other.reason);
268        fieldSetFlags()[3] = true;
269      }
270      if (isValidValue(fields()[4], other.data)) {
271        this.data = data().deepCopy(fields()[4].schema(), other.data);
272        fieldSetFlags()[4] = true;
273      }
274      if (isValidValue(fields()[5], other.asError)) {
275        this.asError = data().deepCopy(fields()[5].schema(), other.asError);
276        fieldSetFlags()[5] = true;
277      }
278    }
279
280    /**
281      * Gets the value of the 'id' field.
282      * @return The value.
283      */
284    public java.lang.CharSequence getId() {
285      return id;
286    }
287
288    /**
289      * Sets the value of the 'id' field.
290      * @param value The value of 'id'.
291      * @return This builder.
292      */
293    public org.apache.reef.io.watcher.common.AvroFailure.Builder setId(java.lang.CharSequence value) {
294      validate(fields()[0], value);
295      this.id = value;
296      fieldSetFlags()[0] = true;
297      return this;
298    }
299
300    /**
301      * Checks whether the 'id' field has been set.
302      * @return True if the 'id' field has been set, false otherwise.
303      */
304    public boolean hasId() {
305      return fieldSetFlags()[0];
306    }
307
308
309    /**
310      * Clears the value of the 'id' field.
311      * @return This builder.
312      */
313    public org.apache.reef.io.watcher.common.AvroFailure.Builder clearId() {
314      id = null;
315      fieldSetFlags()[0] = false;
316      return this;
317    }
318
319    /**
320      * Gets the value of the 'message' field.
321      * @return The value.
322      */
323    public java.lang.CharSequence getMessage() {
324      return message;
325    }
326
327    /**
328      * Sets the value of the 'message' field.
329      * @param value The value of 'message'.
330      * @return This builder.
331      */
332    public org.apache.reef.io.watcher.common.AvroFailure.Builder setMessage(java.lang.CharSequence value) {
333      validate(fields()[1], value);
334      this.message = value;
335      fieldSetFlags()[1] = true;
336      return this;
337    }
338
339    /**
340      * Checks whether the 'message' field has been set.
341      * @return True if the 'message' field has been set, false otherwise.
342      */
343    public boolean hasMessage() {
344      return fieldSetFlags()[1];
345    }
346
347
348    /**
349      * Clears the value of the 'message' field.
350      * @return This builder.
351      */
352    public org.apache.reef.io.watcher.common.AvroFailure.Builder clearMessage() {
353      message = null;
354      fieldSetFlags()[1] = false;
355      return this;
356    }
357
358    /**
359      * Gets the value of the 'description' field.
360      * @return The value.
361      */
362    public java.lang.CharSequence getDescription() {
363      return description;
364    }
365
366    /**
367      * Sets the value of the 'description' field.
368      * @param value The value of 'description'.
369      * @return This builder.
370      */
371    public org.apache.reef.io.watcher.common.AvroFailure.Builder setDescription(java.lang.CharSequence value) {
372      validate(fields()[2], value);
373      this.description = value;
374      fieldSetFlags()[2] = true;
375      return this;
376    }
377
378    /**
379      * Checks whether the 'description' field has been set.
380      * @return True if the 'description' field has been set, false otherwise.
381      */
382    public boolean hasDescription() {
383      return fieldSetFlags()[2];
384    }
385
386
387    /**
388      * Clears the value of the 'description' field.
389      * @return This builder.
390      */
391    public org.apache.reef.io.watcher.common.AvroFailure.Builder clearDescription() {
392      description = null;
393      fieldSetFlags()[2] = false;
394      return this;
395    }
396
397    /**
398      * Gets the value of the 'reason' field.
399      * @return The value.
400      */
401    public java.lang.CharSequence getReason() {
402      return reason;
403    }
404
405    /**
406      * Sets the value of the 'reason' field.
407      * @param value The value of 'reason'.
408      * @return This builder.
409      */
410    public org.apache.reef.io.watcher.common.AvroFailure.Builder setReason(java.lang.CharSequence value) {
411      validate(fields()[3], value);
412      this.reason = value;
413      fieldSetFlags()[3] = true;
414      return this;
415    }
416
417    /**
418      * Checks whether the 'reason' field has been set.
419      * @return True if the 'reason' field has been set, false otherwise.
420      */
421    public boolean hasReason() {
422      return fieldSetFlags()[3];
423    }
424
425
426    /**
427      * Clears the value of the 'reason' field.
428      * @return This builder.
429      */
430    public org.apache.reef.io.watcher.common.AvroFailure.Builder clearReason() {
431      reason = null;
432      fieldSetFlags()[3] = false;
433      return this;
434    }
435
436    /**
437      * Gets the value of the 'data' field.
438      * @return The value.
439      */
440    public java.nio.ByteBuffer getData() {
441      return data;
442    }
443
444    /**
445      * Sets the value of the 'data' field.
446      * @param value The value of 'data'.
447      * @return This builder.
448      */
449    public org.apache.reef.io.watcher.common.AvroFailure.Builder setData(java.nio.ByteBuffer value) {
450      validate(fields()[4], value);
451      this.data = value;
452      fieldSetFlags()[4] = true;
453      return this;
454    }
455
456    /**
457      * Checks whether the 'data' field has been set.
458      * @return True if the 'data' field has been set, false otherwise.
459      */
460    public boolean hasData() {
461      return fieldSetFlags()[4];
462    }
463
464
465    /**
466      * Clears the value of the 'data' field.
467      * @return This builder.
468      */
469    public org.apache.reef.io.watcher.common.AvroFailure.Builder clearData() {
470      data = null;
471      fieldSetFlags()[4] = false;
472      return this;
473    }
474
475    /**
476      * Gets the value of the 'asError' field.
477      * @return The value.
478      */
479    public java.lang.CharSequence getAsError() {
480      return asError;
481    }
482
483    /**
484      * Sets the value of the 'asError' field.
485      * @param value The value of 'asError'.
486      * @return This builder.
487      */
488    public org.apache.reef.io.watcher.common.AvroFailure.Builder setAsError(java.lang.CharSequence value) {
489      validate(fields()[5], value);
490      this.asError = value;
491      fieldSetFlags()[5] = true;
492      return this;
493    }
494
495    /**
496      * Checks whether the 'asError' field has been set.
497      * @return True if the 'asError' field has been set, false otherwise.
498      */
499    public boolean hasAsError() {
500      return fieldSetFlags()[5];
501    }
502
503
504    /**
505      * Clears the value of the 'asError' field.
506      * @return This builder.
507      */
508    public org.apache.reef.io.watcher.common.AvroFailure.Builder clearAsError() {
509      asError = null;
510      fieldSetFlags()[5] = false;
511      return this;
512    }
513
514    @Override
515    public AvroFailure build() {
516      try {
517        AvroFailure record = new AvroFailure();
518        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
519        record.message = fieldSetFlags()[1] ? this.message : (java.lang.CharSequence) defaultValue(fields()[1]);
520        record.description = fieldSetFlags()[2] ? this.description : (java.lang.CharSequence) defaultValue(fields()[2]);
521        record.reason = fieldSetFlags()[3] ? this.reason : (java.lang.CharSequence) defaultValue(fields()[3]);
522        record.data = fieldSetFlags()[4] ? this.data : (java.nio.ByteBuffer) defaultValue(fields()[4]);
523        record.asError = fieldSetFlags()[5] ? this.asError : (java.lang.CharSequence) defaultValue(fields()[5]);
524        return record;
525      } catch (Exception e) {
526        throw new org.apache.avro.AvroRuntimeException(e);
527      }
528    }
529  }
530
531  private static final org.apache.avro.io.DatumWriter
532    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
533
534  @Override public void writeExternal(java.io.ObjectOutput out)
535    throws java.io.IOException {
536    WRITER$.write(this, SpecificData.getEncoder(out));
537  }
538
539  private static final org.apache.avro.io.DatumReader
540    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
541
542  @Override public void readExternal(java.io.ObjectInput in)
543    throws java.io.IOException {
544    READER$.read(this, SpecificData.getDecoder(in));
545  }
546
547}