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.catalog;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroNodeDescriptor extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = 8977837315161323756L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"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\"}]}}}]}}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.lang.CharSequence id;
017  @Deprecated public java.lang.CharSequence name;
018  @Deprecated public java.lang.CharSequence inetSocketAddress;
019  @Deprecated public org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor rackDescriptor;
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 AvroNodeDescriptor() {}
027
028  /**
029   * All-args constructor.
030   * @param id The new value for id
031   * @param name The new value for name
032   * @param inetSocketAddress The new value for inetSocketAddress
033   * @param rackDescriptor The new value for rackDescriptor
034   */
035  public AvroNodeDescriptor(java.lang.CharSequence id, java.lang.CharSequence name, java.lang.CharSequence inetSocketAddress, org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor rackDescriptor) {
036    this.id = id;
037    this.name = name;
038    this.inetSocketAddress = inetSocketAddress;
039    this.rackDescriptor = rackDescriptor;
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 name;
048    case 2: return inetSocketAddress;
049    case 3: return rackDescriptor;
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: name = (java.lang.CharSequence)value$; break;
060    case 2: inetSocketAddress = (java.lang.CharSequence)value$; break;
061    case 3: rackDescriptor = (org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor)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 'name' field.
084   * @return The value of the 'name' field.
085   */
086  public java.lang.CharSequence getName() {
087    return name;
088  }
089
090  /**
091   * Sets the value of the 'name' field.
092   * @param value the value to set.
093   */
094  public void setName(java.lang.CharSequence value) {
095    this.name = value;
096  }
097
098  /**
099   * Gets the value of the 'inetSocketAddress' field.
100   * @return The value of the 'inetSocketAddress' field.
101   */
102  public java.lang.CharSequence getInetSocketAddress() {
103    return inetSocketAddress;
104  }
105
106  /**
107   * Sets the value of the 'inetSocketAddress' field.
108   * @param value the value to set.
109   */
110  public void setInetSocketAddress(java.lang.CharSequence value) {
111    this.inetSocketAddress = value;
112  }
113
114  /**
115   * Gets the value of the 'rackDescriptor' field.
116   * @return The value of the 'rackDescriptor' field.
117   */
118  public org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor getRackDescriptor() {
119    return rackDescriptor;
120  }
121
122  /**
123   * Sets the value of the 'rackDescriptor' field.
124   * @param value the value to set.
125   */
126  public void setRackDescriptor(org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor value) {
127    this.rackDescriptor = value;
128  }
129
130  /**
131   * Creates a new AvroNodeDescriptor RecordBuilder.
132   * @return A new AvroNodeDescriptor RecordBuilder
133   */
134  public static org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder newBuilder() {
135    return new org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder();
136  }
137
138  /**
139   * Creates a new AvroNodeDescriptor RecordBuilder by copying an existing Builder.
140   * @param other The existing builder to copy.
141   * @return A new AvroNodeDescriptor RecordBuilder
142   */
143  public static org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder newBuilder(org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder other) {
144    return new org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder(other);
145  }
146
147  /**
148   * Creates a new AvroNodeDescriptor RecordBuilder by copying an existing AvroNodeDescriptor instance.
149   * @param other The existing instance to copy.
150   * @return A new AvroNodeDescriptor RecordBuilder
151   */
152  public static org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder newBuilder(org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor other) {
153    return new org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder(other);
154  }
155
156  /**
157   * RecordBuilder for AvroNodeDescriptor instances.
158   */
159  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroNodeDescriptor>
160    implements org.apache.avro.data.RecordBuilder<AvroNodeDescriptor> {
161
162    private java.lang.CharSequence id;
163    private java.lang.CharSequence name;
164    private java.lang.CharSequence inetSocketAddress;
165    private org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor rackDescriptor;
166    private org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor.Builder rackDescriptorBuilder;
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.catalog.AvroNodeDescriptor.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.name)) {
184        this.name = data().deepCopy(fields()[1].schema(), other.name);
185        fieldSetFlags()[1] = true;
186      }
187      if (isValidValue(fields()[2], other.inetSocketAddress)) {
188        this.inetSocketAddress = data().deepCopy(fields()[2].schema(), other.inetSocketAddress);
189        fieldSetFlags()[2] = true;
190      }
191      if (isValidValue(fields()[3], other.rackDescriptor)) {
192        this.rackDescriptor = data().deepCopy(fields()[3].schema(), other.rackDescriptor);
193        fieldSetFlags()[3] = true;
194      }
195      if (other.hasRackDescriptorBuilder()) {
196        this.rackDescriptorBuilder = org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor.newBuilder(other.getRackDescriptorBuilder());
197      }
198    }
199
200    /**
201     * Creates a Builder by copying an existing AvroNodeDescriptor instance
202     * @param other The existing instance to copy.
203     */
204    private Builder(org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor 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.name)) {
211        this.name = data().deepCopy(fields()[1].schema(), other.name);
212        fieldSetFlags()[1] = true;
213      }
214      if (isValidValue(fields()[2], other.inetSocketAddress)) {
215        this.inetSocketAddress = data().deepCopy(fields()[2].schema(), other.inetSocketAddress);
216        fieldSetFlags()[2] = true;
217      }
218      if (isValidValue(fields()[3], other.rackDescriptor)) {
219        this.rackDescriptor = data().deepCopy(fields()[3].schema(), other.rackDescriptor);
220        fieldSetFlags()[3] = true;
221      }
222      this.rackDescriptorBuilder = 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.catalog.AvroNodeDescriptor.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.catalog.AvroNodeDescriptor.Builder clearId() {
259      id = null;
260      fieldSetFlags()[0] = false;
261      return this;
262    }
263
264    /**
265      * Gets the value of the 'name' field.
266      * @return The value.
267      */
268    public java.lang.CharSequence getName() {
269      return name;
270    }
271
272    /**
273      * Sets the value of the 'name' field.
274      * @param value The value of 'name'.
275      * @return This builder.
276      */
277    public org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder setName(java.lang.CharSequence value) {
278      validate(fields()[1], value);
279      this.name = value;
280      fieldSetFlags()[1] = true;
281      return this;
282    }
283
284    /**
285      * Checks whether the 'name' field has been set.
286      * @return True if the 'name' field has been set, false otherwise.
287      */
288    public boolean hasName() {
289      return fieldSetFlags()[1];
290    }
291
292
293    /**
294      * Clears the value of the 'name' field.
295      * @return This builder.
296      */
297    public org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder clearName() {
298      name = null;
299      fieldSetFlags()[1] = false;
300      return this;
301    }
302
303    /**
304      * Gets the value of the 'inetSocketAddress' field.
305      * @return The value.
306      */
307    public java.lang.CharSequence getInetSocketAddress() {
308      return inetSocketAddress;
309    }
310
311    /**
312      * Sets the value of the 'inetSocketAddress' field.
313      * @param value The value of 'inetSocketAddress'.
314      * @return This builder.
315      */
316    public org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder setInetSocketAddress(java.lang.CharSequence value) {
317      validate(fields()[2], value);
318      this.inetSocketAddress = value;
319      fieldSetFlags()[2] = true;
320      return this;
321    }
322
323    /**
324      * Checks whether the 'inetSocketAddress' field has been set.
325      * @return True if the 'inetSocketAddress' field has been set, false otherwise.
326      */
327    public boolean hasInetSocketAddress() {
328      return fieldSetFlags()[2];
329    }
330
331
332    /**
333      * Clears the value of the 'inetSocketAddress' field.
334      * @return This builder.
335      */
336    public org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder clearInetSocketAddress() {
337      inetSocketAddress = null;
338      fieldSetFlags()[2] = false;
339      return this;
340    }
341
342    /**
343      * Gets the value of the 'rackDescriptor' field.
344      * @return The value.
345      */
346    public org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor getRackDescriptor() {
347      return rackDescriptor;
348    }
349
350    /**
351      * Sets the value of the 'rackDescriptor' field.
352      * @param value The value of 'rackDescriptor'.
353      * @return This builder.
354      */
355    public org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder setRackDescriptor(org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor value) {
356      validate(fields()[3], value);
357      this.rackDescriptorBuilder = null;
358      this.rackDescriptor = value;
359      fieldSetFlags()[3] = true;
360      return this;
361    }
362
363    /**
364      * Checks whether the 'rackDescriptor' field has been set.
365      * @return True if the 'rackDescriptor' field has been set, false otherwise.
366      */
367    public boolean hasRackDescriptor() {
368      return fieldSetFlags()[3];
369    }
370
371    /**
372     * Gets the Builder instance for the 'rackDescriptor' field and creates one if it doesn't exist yet.
373     * @return This builder.
374     */
375    public org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor.Builder getRackDescriptorBuilder() {
376      if (rackDescriptorBuilder == null) {
377        if (hasRackDescriptor()) {
378          setRackDescriptorBuilder(org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor.newBuilder(rackDescriptor));
379        } else {
380          setRackDescriptorBuilder(org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor.newBuilder());
381        }
382      }
383      return rackDescriptorBuilder;
384    }
385
386    /**
387     * Sets the Builder instance for the 'rackDescriptor' field
388     * @param value The builder instance that must be set.
389     * @return This builder.
390     */
391    public org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder setRackDescriptorBuilder(org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor.Builder value) {
392      clearRackDescriptor();
393      rackDescriptorBuilder = value;
394      return this;
395    }
396
397    /**
398     * Checks whether the 'rackDescriptor' field has an active Builder instance
399     * @return True if the 'rackDescriptor' field has an active Builder instance
400     */
401    public boolean hasRackDescriptorBuilder() {
402      return rackDescriptorBuilder != null;
403    }
404
405    /**
406      * Clears the value of the 'rackDescriptor' field.
407      * @return This builder.
408      */
409    public org.apache.reef.io.watcher.driver.catalog.AvroNodeDescriptor.Builder clearRackDescriptor() {
410      rackDescriptor = null;
411      rackDescriptorBuilder = null;
412      fieldSetFlags()[3] = false;
413      return this;
414    }
415
416    @Override
417    public AvroNodeDescriptor build() {
418      try {
419        AvroNodeDescriptor record = new AvroNodeDescriptor();
420        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
421        record.name = fieldSetFlags()[1] ? this.name : (java.lang.CharSequence) defaultValue(fields()[1]);
422        record.inetSocketAddress = fieldSetFlags()[2] ? this.inetSocketAddress : (java.lang.CharSequence) defaultValue(fields()[2]);
423        if (rackDescriptorBuilder != null) {
424          record.rackDescriptor = this.rackDescriptorBuilder.build();
425        } else {
426          record.rackDescriptor = fieldSetFlags()[3] ? this.rackDescriptor : (org.apache.reef.io.watcher.driver.catalog.AvroRackDescriptor) 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}