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 AvroClosedContext extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -2710604834284196495L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroClosedContext\",\"namespace\":\"org.apache.reef.io.watcher.driver.context\",\"fields\":[{\"name\":\"base\",\"type\":{\"type\":\"record\",\"name\":\"AvroContextBase\",\"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\"]}]}},{\"name\":\"parentContext\",\"type\":{\"type\":\"record\",\"name\":\"AvroActiveContext\",\"fields\":[{\"name\":\"base\",\"type\":\"AvroContextBase\"}]}}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public org.apache.reef.io.watcher.driver.context.AvroContextBase base;
017  @Deprecated public org.apache.reef.io.watcher.driver.context.AvroActiveContext parentContext;
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 AvroClosedContext() {}
025
026  /**
027   * All-args constructor.
028   * @param base The new value for base
029   * @param parentContext The new value for parentContext
030   */
031  public AvroClosedContext(org.apache.reef.io.watcher.driver.context.AvroContextBase base, org.apache.reef.io.watcher.driver.context.AvroActiveContext parentContext) {
032    this.base = base;
033    this.parentContext = parentContext;
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 base;
041    case 1: return parentContext;
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: base = (org.apache.reef.io.watcher.driver.context.AvroContextBase)value$; break;
051    case 1: parentContext = (org.apache.reef.io.watcher.driver.context.AvroActiveContext)value$; break;
052    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
053    }
054  }
055
056  /**
057   * Gets the value of the 'base' field.
058   * @return The value of the 'base' field.
059   */
060  public org.apache.reef.io.watcher.driver.context.AvroContextBase getBase() {
061    return base;
062  }
063
064  /**
065   * Sets the value of the 'base' field.
066   * @param value the value to set.
067   */
068  public void setBase(org.apache.reef.io.watcher.driver.context.AvroContextBase value) {
069    this.base = value;
070  }
071
072  /**
073   * Gets the value of the 'parentContext' field.
074   * @return The value of the 'parentContext' field.
075   */
076  public org.apache.reef.io.watcher.driver.context.AvroActiveContext getParentContext() {
077    return parentContext;
078  }
079
080  /**
081   * Sets the value of the 'parentContext' field.
082   * @param value the value to set.
083   */
084  public void setParentContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) {
085    this.parentContext = value;
086  }
087
088  /**
089   * Creates a new AvroClosedContext RecordBuilder.
090   * @return A new AvroClosedContext RecordBuilder
091   */
092  public static org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder newBuilder() {
093    return new org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder();
094  }
095
096  /**
097   * Creates a new AvroClosedContext RecordBuilder by copying an existing Builder.
098   * @param other The existing builder to copy.
099   * @return A new AvroClosedContext RecordBuilder
100   */
101  public static org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder newBuilder(org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder other) {
102    return new org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder(other);
103  }
104
105  /**
106   * Creates a new AvroClosedContext RecordBuilder by copying an existing AvroClosedContext instance.
107   * @param other The existing instance to copy.
108   * @return A new AvroClosedContext RecordBuilder
109   */
110  public static org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder newBuilder(org.apache.reef.io.watcher.driver.context.AvroClosedContext other) {
111    return new org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder(other);
112  }
113
114  /**
115   * RecordBuilder for AvroClosedContext instances.
116   */
117  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroClosedContext>
118    implements org.apache.avro.data.RecordBuilder<AvroClosedContext> {
119
120    private org.apache.reef.io.watcher.driver.context.AvroContextBase base;
121    private org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder baseBuilder;
122    private org.apache.reef.io.watcher.driver.context.AvroActiveContext parentContext;
123    private org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder parentContextBuilder;
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.io.watcher.driver.context.AvroClosedContext.Builder other) {
135      super(other);
136      if (isValidValue(fields()[0], other.base)) {
137        this.base = data().deepCopy(fields()[0].schema(), other.base);
138        fieldSetFlags()[0] = true;
139      }
140      if (other.hasBaseBuilder()) {
141        this.baseBuilder = org.apache.reef.io.watcher.driver.context.AvroContextBase.newBuilder(other.getBaseBuilder());
142      }
143      if (isValidValue(fields()[1], other.parentContext)) {
144        this.parentContext = data().deepCopy(fields()[1].schema(), other.parentContext);
145        fieldSetFlags()[1] = true;
146      }
147      if (other.hasParentContextBuilder()) {
148        this.parentContextBuilder = org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(other.getParentContextBuilder());
149      }
150    }
151
152    /**
153     * Creates a Builder by copying an existing AvroClosedContext instance
154     * @param other The existing instance to copy.
155     */
156    private Builder(org.apache.reef.io.watcher.driver.context.AvroClosedContext other) {
157            super(SCHEMA$);
158      if (isValidValue(fields()[0], other.base)) {
159        this.base = data().deepCopy(fields()[0].schema(), other.base);
160        fieldSetFlags()[0] = true;
161      }
162      this.baseBuilder = null;
163      if (isValidValue(fields()[1], other.parentContext)) {
164        this.parentContext = data().deepCopy(fields()[1].schema(), other.parentContext);
165        fieldSetFlags()[1] = true;
166      }
167      this.parentContextBuilder = null;
168    }
169
170    /**
171      * Gets the value of the 'base' field.
172      * @return The value.
173      */
174    public org.apache.reef.io.watcher.driver.context.AvroContextBase getBase() {
175      return base;
176    }
177
178    /**
179      * Sets the value of the 'base' field.
180      * @param value The value of 'base'.
181      * @return This builder.
182      */
183    public org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder setBase(org.apache.reef.io.watcher.driver.context.AvroContextBase value) {
184      validate(fields()[0], value);
185      this.baseBuilder = null;
186      this.base = value;
187      fieldSetFlags()[0] = true;
188      return this;
189    }
190
191    /**
192      * Checks whether the 'base' field has been set.
193      * @return True if the 'base' field has been set, false otherwise.
194      */
195    public boolean hasBase() {
196      return fieldSetFlags()[0];
197    }
198
199    /**
200     * Gets the Builder instance for the 'base' field and creates one if it doesn't exist yet.
201     * @return This builder.
202     */
203    public org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder getBaseBuilder() {
204      if (baseBuilder == null) {
205        if (hasBase()) {
206          setBaseBuilder(org.apache.reef.io.watcher.driver.context.AvroContextBase.newBuilder(base));
207        } else {
208          setBaseBuilder(org.apache.reef.io.watcher.driver.context.AvroContextBase.newBuilder());
209        }
210      }
211      return baseBuilder;
212    }
213
214    /**
215     * Sets the Builder instance for the 'base' field
216     * @param value The builder instance that must be set.
217     * @return This builder.
218     */
219    public org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder setBaseBuilder(org.apache.reef.io.watcher.driver.context.AvroContextBase.Builder value) {
220      clearBase();
221      baseBuilder = value;
222      return this;
223    }
224
225    /**
226     * Checks whether the 'base' field has an active Builder instance
227     * @return True if the 'base' field has an active Builder instance
228     */
229    public boolean hasBaseBuilder() {
230      return baseBuilder != null;
231    }
232
233    /**
234      * Clears the value of the 'base' field.
235      * @return This builder.
236      */
237    public org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder clearBase() {
238      base = null;
239      baseBuilder = null;
240      fieldSetFlags()[0] = false;
241      return this;
242    }
243
244    /**
245      * Gets the value of the 'parentContext' field.
246      * @return The value.
247      */
248    public org.apache.reef.io.watcher.driver.context.AvroActiveContext getParentContext() {
249      return parentContext;
250    }
251
252    /**
253      * Sets the value of the 'parentContext' field.
254      * @param value The value of 'parentContext'.
255      * @return This builder.
256      */
257    public org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder setParentContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) {
258      validate(fields()[1], value);
259      this.parentContextBuilder = null;
260      this.parentContext = value;
261      fieldSetFlags()[1] = true;
262      return this;
263    }
264
265    /**
266      * Checks whether the 'parentContext' field has been set.
267      * @return True if the 'parentContext' field has been set, false otherwise.
268      */
269    public boolean hasParentContext() {
270      return fieldSetFlags()[1];
271    }
272
273    /**
274     * Gets the Builder instance for the 'parentContext' field and creates one if it doesn't exist yet.
275     * @return This builder.
276     */
277    public org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder getParentContextBuilder() {
278      if (parentContextBuilder == null) {
279        if (hasParentContext()) {
280          setParentContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(parentContext));
281        } else {
282          setParentContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder());
283        }
284      }
285      return parentContextBuilder;
286    }
287
288    /**
289     * Sets the Builder instance for the 'parentContext' field
290     * @param value The builder instance that must be set.
291     * @return This builder.
292     */
293    public org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder setParentContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder value) {
294      clearParentContext();
295      parentContextBuilder = value;
296      return this;
297    }
298
299    /**
300     * Checks whether the 'parentContext' field has an active Builder instance
301     * @return True if the 'parentContext' field has an active Builder instance
302     */
303    public boolean hasParentContextBuilder() {
304      return parentContextBuilder != null;
305    }
306
307    /**
308      * Clears the value of the 'parentContext' field.
309      * @return This builder.
310      */
311    public org.apache.reef.io.watcher.driver.context.AvroClosedContext.Builder clearParentContext() {
312      parentContext = null;
313      parentContextBuilder = null;
314      fieldSetFlags()[1] = false;
315      return this;
316    }
317
318    @Override
319    public AvroClosedContext build() {
320      try {
321        AvroClosedContext record = new AvroClosedContext();
322        if (baseBuilder != null) {
323          record.base = this.baseBuilder.build();
324        } else {
325          record.base = fieldSetFlags()[0] ? this.base : (org.apache.reef.io.watcher.driver.context.AvroContextBase) defaultValue(fields()[0]);
326        }
327        if (parentContextBuilder != null) {
328          record.parentContext = this.parentContextBuilder.build();
329        } else {
330          record.parentContext = fieldSetFlags()[1] ? this.parentContext : (org.apache.reef.io.watcher.driver.context.AvroActiveContext) 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}