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