This project has retired. For details please refer to its Attic page.
Source code
001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.io.watcher.driver.context;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroContextBase extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = 8738404534951961157L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroContextBase\",\"namespace\":\"org.apache.reef.io.watcher.driver.context\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"evaluatorId\",\"type\":\"string\"},{\"name\":\"parentId\",\"type\":[\"string\",\"null\"]},{\"name\":\"evaluatorDescriptor\",\"type\":[{\"type\":\"record\",\"name\":\"AvroEvaluatorDescriptor\",\"namespace\":\"org.apache.reef.io.watcher.driver.evaluator\",\"fields\":[{\"name\":\"nodeDescriptor\",\"type\":{\"type\":\"record\",\"name\":\"AvroNodeDescriptor\",\"namespace\":\"org.apache.reef.io.watcher.driver.catalog\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"inetSocketAddress\",\"type\":\"string\"},{\"name\":\"rackDescriptor\",\"type\":{\"type\":\"record\",\"name\":\"AvroRackDescriptor\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"nodes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"AvroNodeDescriptorInRackDescriptor\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"inetSocketAddress\",\"type\":\"string\"}]}}}]}}]}},{\"name\":\"process\",\"type\":{\"type\":\"record\",\"name\":\"AvroEvaluatorProcess\",\"fields\":[{\"name\":\"commandLines\",\"type\":{\"type\":\"array\",\"items\":[\"string\",\"null\"]}},{\"name\":\"evaluatorType\",\"type\":{\"type\":\"enum\",\"name\":\"AvroEvaluatorType\",\"symbols\":[\"JVM\",\"CLR\",\"UNDECIDED\"]}},{\"name\":\"isOptionSet\",\"type\":\"boolean\"}]}},{\"name\":\"memory\",\"type\":\"int\"},{\"name\":\"numberOfCores\",\"type\":\"int\"}]},\"null\"]}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.lang.CharSequence id;
017  @Deprecated public java.lang.CharSequence evaluatorId;
018  @Deprecated public java.lang.CharSequence parentId;
019  @Deprecated public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor evaluatorDescriptor;
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 AvroContextBase() {}
027
028  /**
029   * All-args constructor.
030   * @param id The new value for id
031   * @param evaluatorId The new value for evaluatorId
032   * @param parentId The new value for parentId
033   * @param evaluatorDescriptor The new value for evaluatorDescriptor
034   */
035  public AvroContextBase(java.lang.CharSequence id, java.lang.CharSequence evaluatorId, java.lang.CharSequence parentId, org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor evaluatorDescriptor) {
036    this.id = id;
037    this.evaluatorId = evaluatorId;
038    this.parentId = parentId;
039    this.evaluatorDescriptor = evaluatorDescriptor;
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 evaluatorId;
048    case 2: return parentId;
049    case 3: return evaluatorDescriptor;
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: evaluatorId = (java.lang.CharSequence)value$; break;
060    case 2: parentId = (java.lang.CharSequence)value$; break;
061    case 3: evaluatorDescriptor = (org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor)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 'evaluatorId' field.
084   * @return The value of the 'evaluatorId' field.
085   */
086  public java.lang.CharSequence getEvaluatorId() {
087    return evaluatorId;
088  }
089
090  /**
091   * Sets the value of the 'evaluatorId' field.
092   * @param value the value to set.
093   */
094  public void setEvaluatorId(java.lang.CharSequence value) {
095    this.evaluatorId = value;
096  }
097
098  /**
099   * Gets the value of the 'parentId' field.
100   * @return The value of the 'parentId' field.
101   */
102  public java.lang.CharSequence getParentId() {
103    return parentId;
104  }
105
106  /**
107   * Sets the value of the 'parentId' field.
108   * @param value the value to set.
109   */
110  public void setParentId(java.lang.CharSequence value) {
111    this.parentId = value;
112  }
113
114  /**
115   * Gets the value of the 'evaluatorDescriptor' field.
116   * @return The value of the 'evaluatorDescriptor' field.
117   */
118  public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor getEvaluatorDescriptor() {
119    return evaluatorDescriptor;
120  }
121
122  /**
123   * Sets the value of the 'evaluatorDescriptor' field.
124   * @param value the value to set.
125   */
126  public void setEvaluatorDescriptor(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor value) {
127    this.evaluatorDescriptor = value;
128  }
129
130  /**
131   * Creates a new AvroContextBase RecordBuilder.
132   * @return A new AvroContextBase RecordBuilder
133   */
134  public static org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder newBuilder() {
135    return new org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder();
136  }
137
138  /**
139   * Creates a new AvroContextBase RecordBuilder by copying an existing Builder.
140   * @param other The existing builder to copy.
141   * @return A new AvroContextBase RecordBuilder
142   */
143  public static org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder newBuilder(org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder other) {
144    return new org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder(other);
145  }
146
147  /**
148   * Creates a new AvroContextBase RecordBuilder by copying an existing AvroContextBase instance.
149   * @param other The existing instance to copy.
150   * @return A new AvroContextBase RecordBuilder
151   */
152  public static org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder newBuilder(org.apache.reef.io.watcher.driver.context.AvroContextBase other) {
153    return new org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder(other);
154  }
155
156  /**
157   * RecordBuilder for AvroContextBase instances.
158   */
159  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroContextBase>
160    implements org.apache.avro.data.RecordBuilder<AvroContextBase> {
161
162    private java.lang.CharSequence id;
163    private java.lang.CharSequence evaluatorId;
164    private java.lang.CharSequence parentId;
165    private org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor evaluatorDescriptor;
166    private org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.Builder evaluatorDescriptorBuilder;
167
168    /** Creates a new Builder */
169    private Builder() {
170      super(SCHEMA$);
171    }
172
173    /**
174     * Creates a Builder by copying an existing Builder.
175     * @param other The existing Builder to copy.
176     */
177    private Builder(org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder other) {
178      super(other);
179      if (isValidValue(fields()[0], other.id)) {
180        this.id = data().deepCopy(fields()[0].schema(), other.id);
181        fieldSetFlags()[0] = true;
182      }
183      if (isValidValue(fields()[1], other.evaluatorId)) {
184        this.evaluatorId = data().deepCopy(fields()[1].schema(), other.evaluatorId);
185        fieldSetFlags()[1] = true;
186      }
187      if (isValidValue(fields()[2], other.parentId)) {
188        this.parentId = data().deepCopy(fields()[2].schema(), other.parentId);
189        fieldSetFlags()[2] = true;
190      }
191      if (isValidValue(fields()[3], other.evaluatorDescriptor)) {
192        this.evaluatorDescriptor = data().deepCopy(fields()[3].schema(), other.evaluatorDescriptor);
193        fieldSetFlags()[3] = true;
194      }
195      if (other.hasEvaluatorDescriptorBuilder()) {
196        this.evaluatorDescriptorBuilder = org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.newBuilder(other.getEvaluatorDescriptorBuilder());
197      }
198    }
199
200    /**
201     * Creates a Builder by copying an existing AvroContextBase instance
202     * @param other The existing instance to copy.
203     */
204    private Builder(org.apache.reef.io.watcher.driver.context.AvroContextBase other) {
205            super(SCHEMA$);
206      if (isValidValue(fields()[0], other.id)) {
207        this.id = data().deepCopy(fields()[0].schema(), other.id);
208        fieldSetFlags()[0] = true;
209      }
210      if (isValidValue(fields()[1], other.evaluatorId)) {
211        this.evaluatorId = data().deepCopy(fields()[1].schema(), other.evaluatorId);
212        fieldSetFlags()[1] = true;
213      }
214      if (isValidValue(fields()[2], other.parentId)) {
215        this.parentId = data().deepCopy(fields()[2].schema(), other.parentId);
216        fieldSetFlags()[2] = true;
217      }
218      if (isValidValue(fields()[3], other.evaluatorDescriptor)) {
219        this.evaluatorDescriptor = data().deepCopy(fields()[3].schema(), other.evaluatorDescriptor);
220        fieldSetFlags()[3] = true;
221      }
222      this.evaluatorDescriptorBuilder = null;
223    }
224
225    /**
226      * Gets the value of the 'id' field.
227      * @return The value.
228      */
229    public java.lang.CharSequence getId() {
230      return id;
231    }
232
233    /**
234      * Sets the value of the 'id' field.
235      * @param value The value of 'id'.
236      * @return This builder.
237      */
238    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder setId(java.lang.CharSequence value) {
239      validate(fields()[0], value);
240      this.id = value;
241      fieldSetFlags()[0] = true;
242      return this;
243    }
244
245    /**
246      * Checks whether the 'id' field has been set.
247      * @return True if the 'id' field has been set, false otherwise.
248      */
249    public boolean hasId() {
250      return fieldSetFlags()[0];
251    }
252
253
254    /**
255      * Clears the value of the 'id' field.
256      * @return This builder.
257      */
258    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder clearId() {
259      id = null;
260      fieldSetFlags()[0] = false;
261      return this;
262    }
263
264    /**
265      * Gets the value of the 'evaluatorId' field.
266      * @return The value.
267      */
268    public java.lang.CharSequence getEvaluatorId() {
269      return evaluatorId;
270    }
271
272    /**
273      * Sets the value of the 'evaluatorId' field.
274      * @param value The value of 'evaluatorId'.
275      * @return This builder.
276      */
277    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder setEvaluatorId(java.lang.CharSequence value) {
278      validate(fields()[1], value);
279      this.evaluatorId = value;
280      fieldSetFlags()[1] = true;
281      return this;
282    }
283
284    /**
285      * Checks whether the 'evaluatorId' field has been set.
286      * @return True if the 'evaluatorId' field has been set, false otherwise.
287      */
288    public boolean hasEvaluatorId() {
289      return fieldSetFlags()[1];
290    }
291
292
293    /**
294      * Clears the value of the 'evaluatorId' field.
295      * @return This builder.
296      */
297    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder clearEvaluatorId() {
298      evaluatorId = null;
299      fieldSetFlags()[1] = false;
300      return this;
301    }
302
303    /**
304      * Gets the value of the 'parentId' field.
305      * @return The value.
306      */
307    public java.lang.CharSequence getParentId() {
308      return parentId;
309    }
310
311    /**
312      * Sets the value of the 'parentId' field.
313      * @param value The value of 'parentId'.
314      * @return This builder.
315      */
316    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder setParentId(java.lang.CharSequence value) {
317      validate(fields()[2], value);
318      this.parentId = value;
319      fieldSetFlags()[2] = true;
320      return this;
321    }
322
323    /**
324      * Checks whether the 'parentId' field has been set.
325      * @return True if the 'parentId' field has been set, false otherwise.
326      */
327    public boolean hasParentId() {
328      return fieldSetFlags()[2];
329    }
330
331
332    /**
333      * Clears the value of the 'parentId' field.
334      * @return This builder.
335      */
336    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder clearParentId() {
337      parentId = null;
338      fieldSetFlags()[2] = false;
339      return this;
340    }
341
342    /**
343      * Gets the value of the 'evaluatorDescriptor' field.
344      * @return The value.
345      */
346    public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor getEvaluatorDescriptor() {
347      return evaluatorDescriptor;
348    }
349
350    /**
351      * Sets the value of the 'evaluatorDescriptor' field.
352      * @param value The value of 'evaluatorDescriptor'.
353      * @return This builder.
354      */
355    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder setEvaluatorDescriptor(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor value) {
356      validate(fields()[3], value);
357      this.evaluatorDescriptorBuilder = null;
358      this.evaluatorDescriptor = value;
359      fieldSetFlags()[3] = true;
360      return this;
361    }
362
363    /**
364      * Checks whether the 'evaluatorDescriptor' field has been set.
365      * @return True if the 'evaluatorDescriptor' field has been set, false otherwise.
366      */
367    public boolean hasEvaluatorDescriptor() {
368      return fieldSetFlags()[3];
369    }
370
371    /**
372     * Gets the Builder instance for the 'evaluatorDescriptor' field and creates one if it doesn't exist yet.
373     * @return This builder.
374     */
375    public org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.Builder getEvaluatorDescriptorBuilder() {
376      if (evaluatorDescriptorBuilder == null) {
377        if (hasEvaluatorDescriptor()) {
378          setEvaluatorDescriptorBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.newBuilder(evaluatorDescriptor));
379        } else {
380          setEvaluatorDescriptorBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.newBuilder());
381        }
382      }
383      return evaluatorDescriptorBuilder;
384    }
385
386    /**
387     * Sets the Builder instance for the 'evaluatorDescriptor' field
388     * @param value The builder instance that must be set.
389     * @return This builder.
390     */
391    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder setEvaluatorDescriptorBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor.Builder value) {
392      clearEvaluatorDescriptor();
393      evaluatorDescriptorBuilder = value;
394      return this;
395    }
396
397    /**
398     * Checks whether the 'evaluatorDescriptor' field has an active Builder instance
399     * @return True if the 'evaluatorDescriptor' field has an active Builder instance
400     */
401    public boolean hasEvaluatorDescriptorBuilder() {
402      return evaluatorDescriptorBuilder != null;
403    }
404
405    /**
406      * Clears the value of the 'evaluatorDescriptor' field.
407      * @return This builder.
408      */
409    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder clearEvaluatorDescriptor() {
410      evaluatorDescriptor = null;
411      evaluatorDescriptorBuilder = null;
412      fieldSetFlags()[3] = false;
413      return this;
414    }
415
416    @Override
417    public AvroContextBase build() {
418      try {
419        AvroContextBase record = new AvroContextBase();
420        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
421        record.evaluatorId = fieldSetFlags()[1] ? this.evaluatorId : (java.lang.CharSequence) defaultValue(fields()[1]);
422        record.parentId = fieldSetFlags()[2] ? this.parentId : (java.lang.CharSequence) defaultValue(fields()[2]);
423        if (evaluatorDescriptorBuilder != null) {
424          record.evaluatorDescriptor = this.evaluatorDescriptorBuilder.build();
425        } else {
426          record.evaluatorDescriptor = fieldSetFlags()[3] ? this.evaluatorDescriptor : (org.apache.reef.io.watcher.driver.evaluator.AvroEvaluatorDescriptor) defaultValue(fields()[3]);
427        }
428        return record;
429      } catch (Exception e) {
430        throw new org.apache.avro.AvroRuntimeException(e);
431      }
432    }
433  }
434
435  private static final org.apache.avro.io.DatumWriter
436    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
437
438  @Override public void writeExternal(java.io.ObjectOutput out)
439    throws java.io.IOException {
440    WRITER$.write(this, SpecificData.getEncoder(out));
441  }
442
443  private static final org.apache.avro.io.DatumReader
444    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
445
446  @Override public void readExternal(java.io.ObjectInput in)
447    throws java.io.IOException {
448    READER$.read(this, SpecificData.getDecoder(in));
449  }
450
451}