001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.io.watcher.driver.task;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroTaskMessage extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = 5310660360736022878L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroTaskMessage\",\"namespace\":\"org.apache.reef.io.watcher.driver.task\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"contextId\",\"type\":\"string\"},{\"name\":\"messageSourceId\",\"type\":\"string\"},{\"name\":\"get\",\"type\":[\"bytes\",\"null\"]}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.lang.CharSequence id;
017  @Deprecated public java.lang.CharSequence contextId;
018  @Deprecated public java.lang.CharSequence messageSourceId;
019  @Deprecated public java.nio.ByteBuffer get;
020
021  /**
022   * Default constructor.  Note that this does not initialize fields
023   * to their default values from the schema.  If that is desired then
024   * one should use <code>newBuilder()</code>.
025   */
026  public AvroTaskMessage() {}
027
028  /**
029   * All-args constructor.
030   * @param id The new value for id
031   * @param contextId The new value for contextId
032   * @param messageSourceId The new value for messageSourceId
033   * @param get The new value for get
034   */
035  public AvroTaskMessage(java.lang.CharSequence id, java.lang.CharSequence contextId, java.lang.CharSequence messageSourceId, java.nio.ByteBuffer get) {
036    this.id = id;
037    this.contextId = contextId;
038    this.messageSourceId = messageSourceId;
039    this.get = get;
040  }
041
042  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
043  // Used by DatumWriter.  Applications should not call.
044  public java.lang.Object get(int field$) {
045    switch (field$) {
046    case 0: return id;
047    case 1: return contextId;
048    case 2: return messageSourceId;
049    case 3: return get;
050    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
051    }
052  }
053
054  // Used by DatumReader.  Applications should not call.
055  @SuppressWarnings(value="unchecked")
056  public void put(int field$, java.lang.Object value$) {
057    switch (field$) {
058    case 0: id = (java.lang.CharSequence)value$; break;
059    case 1: contextId = (java.lang.CharSequence)value$; break;
060    case 2: messageSourceId = (java.lang.CharSequence)value$; break;
061    case 3: get = (java.nio.ByteBuffer)value$; break;
062    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
063    }
064  }
065
066  /**
067   * Gets the value of the 'id' field.
068   * @return The value of the 'id' field.
069   */
070  public java.lang.CharSequence getId() {
071    return id;
072  }
073
074  /**
075   * Sets the value of the 'id' field.
076   * @param value the value to set.
077   */
078  public void setId(java.lang.CharSequence value) {
079    this.id = value;
080  }
081
082  /**
083   * Gets the value of the 'contextId' field.
084   * @return The value of the 'contextId' field.
085   */
086  public java.lang.CharSequence getContextId() {
087    return contextId;
088  }
089
090  /**
091   * Sets the value of the 'contextId' field.
092   * @param value the value to set.
093   */
094  public void setContextId(java.lang.CharSequence value) {
095    this.contextId = value;
096  }
097
098  /**
099   * Gets the value of the 'messageSourceId' field.
100   * @return The value of the 'messageSourceId' field.
101   */
102  public java.lang.CharSequence getMessageSourceId() {
103    return messageSourceId;
104  }
105
106  /**
107   * Sets the value of the 'messageSourceId' field.
108   * @param value the value to set.
109   */
110  public void setMessageSourceId(java.lang.CharSequence value) {
111    this.messageSourceId = value;
112  }
113
114  /**
115   * Gets the value of the 'get' field.
116   * @return The value of the 'get' field.
117   */
118  public java.nio.ByteBuffer getGet() {
119    return get;
120  }
121
122  /**
123   * Sets the value of the 'get' field.
124   * @param value the value to set.
125   */
126  public void setGet(java.nio.ByteBuffer value) {
127    this.get = value;
128  }
129
130  /**
131   * Creates a new AvroTaskMessage RecordBuilder.
132   * @return A new AvroTaskMessage RecordBuilder
133   */
134  public static org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder newBuilder() {
135    return new org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder();
136  }
137
138  /**
139   * Creates a new AvroTaskMessage RecordBuilder by copying an existing Builder.
140   * @param other The existing builder to copy.
141   * @return A new AvroTaskMessage RecordBuilder
142   */
143  public static org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder other) {
144    return new org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder(other);
145  }
146
147  /**
148   * Creates a new AvroTaskMessage RecordBuilder by copying an existing AvroTaskMessage instance.
149   * @param other The existing instance to copy.
150   * @return A new AvroTaskMessage RecordBuilder
151   */
152  public static org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroTaskMessage other) {
153    return new org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder(other);
154  }
155
156  /**
157   * RecordBuilder for AvroTaskMessage instances.
158   */
159  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroTaskMessage>
160    implements org.apache.avro.data.RecordBuilder<AvroTaskMessage> {
161
162    private java.lang.CharSequence id;
163    private java.lang.CharSequence contextId;
164    private java.lang.CharSequence messageSourceId;
165    private java.nio.ByteBuffer get;
166
167    /** Creates a new Builder */
168    private Builder() {
169      super(SCHEMA$);
170    }
171
172    /**
173     * Creates a Builder by copying an existing Builder.
174     * @param other The existing Builder to copy.
175     */
176    private Builder(org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder other) {
177      super(other);
178      if (isValidValue(fields()[0], other.id)) {
179        this.id = data().deepCopy(fields()[0].schema(), other.id);
180        fieldSetFlags()[0] = true;
181      }
182      if (isValidValue(fields()[1], other.contextId)) {
183        this.contextId = data().deepCopy(fields()[1].schema(), other.contextId);
184        fieldSetFlags()[1] = true;
185      }
186      if (isValidValue(fields()[2], other.messageSourceId)) {
187        this.messageSourceId = data().deepCopy(fields()[2].schema(), other.messageSourceId);
188        fieldSetFlags()[2] = true;
189      }
190      if (isValidValue(fields()[3], other.get)) {
191        this.get = data().deepCopy(fields()[3].schema(), other.get);
192        fieldSetFlags()[3] = true;
193      }
194    }
195
196    /**
197     * Creates a Builder by copying an existing AvroTaskMessage instance
198     * @param other The existing instance to copy.
199     */
200    private Builder(org.apache.reef.io.watcher.driver.task.AvroTaskMessage other) {
201            super(SCHEMA$);
202      if (isValidValue(fields()[0], other.id)) {
203        this.id = data().deepCopy(fields()[0].schema(), other.id);
204        fieldSetFlags()[0] = true;
205      }
206      if (isValidValue(fields()[1], other.contextId)) {
207        this.contextId = data().deepCopy(fields()[1].schema(), other.contextId);
208        fieldSetFlags()[1] = true;
209      }
210      if (isValidValue(fields()[2], other.messageSourceId)) {
211        this.messageSourceId = data().deepCopy(fields()[2].schema(), other.messageSourceId);
212        fieldSetFlags()[2] = true;
213      }
214      if (isValidValue(fields()[3], other.get)) {
215        this.get = data().deepCopy(fields()[3].schema(), other.get);
216        fieldSetFlags()[3] = true;
217      }
218    }
219
220    /**
221      * Gets the value of the 'id' field.
222      * @return The value.
223      */
224    public java.lang.CharSequence getId() {
225      return id;
226    }
227
228    /**
229      * Sets the value of the 'id' field.
230      * @param value The value of 'id'.
231      * @return This builder.
232      */
233    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder setId(java.lang.CharSequence value) {
234      validate(fields()[0], value);
235      this.id = value;
236      fieldSetFlags()[0] = true;
237      return this;
238    }
239
240    /**
241      * Checks whether the 'id' field has been set.
242      * @return True if the 'id' field has been set, false otherwise.
243      */
244    public boolean hasId() {
245      return fieldSetFlags()[0];
246    }
247
248
249    /**
250      * Clears the value of the 'id' field.
251      * @return This builder.
252      */
253    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder clearId() {
254      id = null;
255      fieldSetFlags()[0] = false;
256      return this;
257    }
258
259    /**
260      * Gets the value of the 'contextId' field.
261      * @return The value.
262      */
263    public java.lang.CharSequence getContextId() {
264      return contextId;
265    }
266
267    /**
268      * Sets the value of the 'contextId' field.
269      * @param value The value of 'contextId'.
270      * @return This builder.
271      */
272    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder setContextId(java.lang.CharSequence value) {
273      validate(fields()[1], value);
274      this.contextId = value;
275      fieldSetFlags()[1] = true;
276      return this;
277    }
278
279    /**
280      * Checks whether the 'contextId' field has been set.
281      * @return True if the 'contextId' field has been set, false otherwise.
282      */
283    public boolean hasContextId() {
284      return fieldSetFlags()[1];
285    }
286
287
288    /**
289      * Clears the value of the 'contextId' field.
290      * @return This builder.
291      */
292    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder clearContextId() {
293      contextId = null;
294      fieldSetFlags()[1] = false;
295      return this;
296    }
297
298    /**
299      * Gets the value of the 'messageSourceId' field.
300      * @return The value.
301      */
302    public java.lang.CharSequence getMessageSourceId() {
303      return messageSourceId;
304    }
305
306    /**
307      * Sets the value of the 'messageSourceId' field.
308      * @param value The value of 'messageSourceId'.
309      * @return This builder.
310      */
311    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder setMessageSourceId(java.lang.CharSequence value) {
312      validate(fields()[2], value);
313      this.messageSourceId = value;
314      fieldSetFlags()[2] = true;
315      return this;
316    }
317
318    /**
319      * Checks whether the 'messageSourceId' field has been set.
320      * @return True if the 'messageSourceId' field has been set, false otherwise.
321      */
322    public boolean hasMessageSourceId() {
323      return fieldSetFlags()[2];
324    }
325
326
327    /**
328      * Clears the value of the 'messageSourceId' field.
329      * @return This builder.
330      */
331    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder clearMessageSourceId() {
332      messageSourceId = null;
333      fieldSetFlags()[2] = false;
334      return this;
335    }
336
337    /**
338      * Gets the value of the 'get' field.
339      * @return The value.
340      */
341    public java.nio.ByteBuffer getGet() {
342      return get;
343    }
344
345    /**
346      * Sets the value of the 'get' field.
347      * @param value The value of 'get'.
348      * @return This builder.
349      */
350    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder setGet(java.nio.ByteBuffer value) {
351      validate(fields()[3], value);
352      this.get = value;
353      fieldSetFlags()[3] = true;
354      return this;
355    }
356
357    /**
358      * Checks whether the 'get' field has been set.
359      * @return True if the 'get' field has been set, false otherwise.
360      */
361    public boolean hasGet() {
362      return fieldSetFlags()[3];
363    }
364
365
366    /**
367      * Clears the value of the 'get' field.
368      * @return This builder.
369      */
370    public org.apache.reef.io.watcher.driver.task.AvroTaskMessage.Builder clearGet() {
371      get = null;
372      fieldSetFlags()[3] = false;
373      return this;
374    }
375
376    @Override
377    public AvroTaskMessage build() {
378      try {
379        AvroTaskMessage record = new AvroTaskMessage();
380        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
381        record.contextId = fieldSetFlags()[1] ? this.contextId : (java.lang.CharSequence) defaultValue(fields()[1]);
382        record.messageSourceId = fieldSetFlags()[2] ? this.messageSourceId : (java.lang.CharSequence) defaultValue(fields()[2]);
383        record.get = fieldSetFlags()[3] ? this.get : (java.nio.ByteBuffer) defaultValue(fields()[3]);
384        return record;
385      } catch (Exception e) {
386        throw new org.apache.avro.AvroRuntimeException(e);
387      }
388    }
389  }
390
391  private static final org.apache.avro.io.DatumWriter
392    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
393
394  @Override public void writeExternal(java.io.ObjectOutput out)
395    throws java.io.IOException {
396    WRITER$.write(this, SpecificData.getEncoder(out));
397  }
398
399  private static final org.apache.avro.io.DatumReader
400    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
401
402  @Override public void readExternal(java.io.ObjectInput in)
403    throws java.io.IOException {
404    READER$.read(this, SpecificData.getDecoder(in));
405  }
406
407}