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.runtime.multi.utils.avro;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011/** Defines the schema for multi runtime definition. This avro object is used to pass multi runtime definition to the runtimes host */
012@org.apache.avro.specific.AvroGenerated
013public class AvroMultiRuntimeDefinition extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
014  private static final long serialVersionUID = -8864870597261424800L;
015  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroMultiRuntimeDefinition\",\"namespace\":\"org.apache.reef.runtime.multi.utils.avro\",\"doc\":\"Defines the schema for multi runtime definition. This avro object is used to pass multi runtime definition to the runtimes host\",\"fields\":[{\"name\":\"defaultRuntimeName\",\"type\":\"string\",\"doc\":\"The name of the default runtime\"},{\"name\":\"runtimes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"AvroRuntimeDefinition\",\"doc\":\"Defines the schema for runtime definition. This avro object is used to pass runtimes definitions to the runtimes host\",\"fields\":[{\"name\":\"runtimeName\",\"type\":\"string\",\"doc\":\"The name of the runtime, that will be provided with the resource allocation requests\"},{\"name\":\"serializedConfiguration\",\"type\":\"string\",\"doc\":\"Serialized Tang configuration\"}]}},\"doc\":\"defined runtimes\"}]}");
016  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
017  /** The name of the default runtime */
018  @Deprecated public java.lang.CharSequence defaultRuntimeName;
019  /** defined runtimes */
020  @Deprecated public java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> runtimes;
021
022  /**
023   * Default constructor.  Note that this does not initialize fields
024   * to their default values from the schema.  If that is desired then
025   * one should use <code>newBuilder()</code>.
026   */
027  public AvroMultiRuntimeDefinition() {}
028
029  /**
030   * All-args constructor.
031   * @param defaultRuntimeName The name of the default runtime
032   * @param runtimes defined runtimes
033   */
034  public AvroMultiRuntimeDefinition(java.lang.CharSequence defaultRuntimeName, java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> runtimes) {
035    this.defaultRuntimeName = defaultRuntimeName;
036    this.runtimes = runtimes;
037  }
038
039  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
040  // Used by DatumWriter.  Applications should not call.
041  public java.lang.Object get(int field$) {
042    switch (field$) {
043    case 0: return defaultRuntimeName;
044    case 1: return runtimes;
045    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
046    }
047  }
048
049  // Used by DatumReader.  Applications should not call.
050  @SuppressWarnings(value="unchecked")
051  public void put(int field$, java.lang.Object value$) {
052    switch (field$) {
053    case 0: defaultRuntimeName = (java.lang.CharSequence)value$; break;
054    case 1: runtimes = (java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition>)value$; break;
055    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
056    }
057  }
058
059  /**
060   * Gets the value of the 'defaultRuntimeName' field.
061   * @return The name of the default runtime
062   */
063  public java.lang.CharSequence getDefaultRuntimeName() {
064    return defaultRuntimeName;
065  }
066
067  /**
068   * Sets the value of the 'defaultRuntimeName' field.
069   * The name of the default runtime
070   * @param value the value to set.
071   */
072  public void setDefaultRuntimeName(java.lang.CharSequence value) {
073    this.defaultRuntimeName = value;
074  }
075
076  /**
077   * Gets the value of the 'runtimes' field.
078   * @return defined runtimes
079   */
080  public java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> getRuntimes() {
081    return runtimes;
082  }
083
084  /**
085   * Sets the value of the 'runtimes' field.
086   * defined runtimes
087   * @param value the value to set.
088   */
089  public void setRuntimes(java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> value) {
090    this.runtimes = value;
091  }
092
093  /**
094   * Creates a new AvroMultiRuntimeDefinition RecordBuilder.
095   * @return A new AvroMultiRuntimeDefinition RecordBuilder
096   */
097  public static org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder newBuilder() {
098    return new org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder();
099  }
100
101  /**
102   * Creates a new AvroMultiRuntimeDefinition RecordBuilder by copying an existing Builder.
103   * @param other The existing builder to copy.
104   * @return A new AvroMultiRuntimeDefinition RecordBuilder
105   */
106  public static org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder other) {
107    return new org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder(other);
108  }
109
110  /**
111   * Creates a new AvroMultiRuntimeDefinition RecordBuilder by copying an existing AvroMultiRuntimeDefinition instance.
112   * @param other The existing instance to copy.
113   * @return A new AvroMultiRuntimeDefinition RecordBuilder
114   */
115  public static org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition other) {
116    return new org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder(other);
117  }
118
119  /**
120   * RecordBuilder for AvroMultiRuntimeDefinition instances.
121   */
122  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroMultiRuntimeDefinition>
123    implements org.apache.avro.data.RecordBuilder<AvroMultiRuntimeDefinition> {
124
125    /** The name of the default runtime */
126    private java.lang.CharSequence defaultRuntimeName;
127    /** defined runtimes */
128    private java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> runtimes;
129
130    /** Creates a new Builder */
131    private Builder() {
132      super(SCHEMA$);
133    }
134
135    /**
136     * Creates a Builder by copying an existing Builder.
137     * @param other The existing Builder to copy.
138     */
139    private Builder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder other) {
140      super(other);
141      if (isValidValue(fields()[0], other.defaultRuntimeName)) {
142        this.defaultRuntimeName = data().deepCopy(fields()[0].schema(), other.defaultRuntimeName);
143        fieldSetFlags()[0] = true;
144      }
145      if (isValidValue(fields()[1], other.runtimes)) {
146        this.runtimes = data().deepCopy(fields()[1].schema(), other.runtimes);
147        fieldSetFlags()[1] = true;
148      }
149    }
150
151    /**
152     * Creates a Builder by copying an existing AvroMultiRuntimeDefinition instance
153     * @param other The existing instance to copy.
154     */
155    private Builder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition other) {
156            super(SCHEMA$);
157      if (isValidValue(fields()[0], other.defaultRuntimeName)) {
158        this.defaultRuntimeName = data().deepCopy(fields()[0].schema(), other.defaultRuntimeName);
159        fieldSetFlags()[0] = true;
160      }
161      if (isValidValue(fields()[1], other.runtimes)) {
162        this.runtimes = data().deepCopy(fields()[1].schema(), other.runtimes);
163        fieldSetFlags()[1] = true;
164      }
165    }
166
167    /**
168      * Gets the value of the 'defaultRuntimeName' field.
169      * The name of the default runtime
170      * @return The value.
171      */
172    public java.lang.CharSequence getDefaultRuntimeName() {
173      return defaultRuntimeName;
174    }
175
176    /**
177      * Sets the value of the 'defaultRuntimeName' field.
178      * The name of the default runtime
179      * @param value The value of 'defaultRuntimeName'.
180      * @return This builder.
181      */
182    public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder setDefaultRuntimeName(java.lang.CharSequence value) {
183      validate(fields()[0], value);
184      this.defaultRuntimeName = value;
185      fieldSetFlags()[0] = true;
186      return this;
187    }
188
189    /**
190      * Checks whether the 'defaultRuntimeName' field has been set.
191      * The name of the default runtime
192      * @return True if the 'defaultRuntimeName' field has been set, false otherwise.
193      */
194    public boolean hasDefaultRuntimeName() {
195      return fieldSetFlags()[0];
196    }
197
198
199    /**
200      * Clears the value of the 'defaultRuntimeName' field.
201      * The name of the default runtime
202      * @return This builder.
203      */
204    public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder clearDefaultRuntimeName() {
205      defaultRuntimeName = null;
206      fieldSetFlags()[0] = false;
207      return this;
208    }
209
210    /**
211      * Gets the value of the 'runtimes' field.
212      * defined runtimes
213      * @return The value.
214      */
215    public java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> getRuntimes() {
216      return runtimes;
217    }
218
219    /**
220      * Sets the value of the 'runtimes' field.
221      * defined runtimes
222      * @param value The value of 'runtimes'.
223      * @return This builder.
224      */
225    public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder setRuntimes(java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> value) {
226      validate(fields()[1], value);
227      this.runtimes = value;
228      fieldSetFlags()[1] = true;
229      return this;
230    }
231
232    /**
233      * Checks whether the 'runtimes' field has been set.
234      * defined runtimes
235      * @return True if the 'runtimes' field has been set, false otherwise.
236      */
237    public boolean hasRuntimes() {
238      return fieldSetFlags()[1];
239    }
240
241
242    /**
243      * Clears the value of the 'runtimes' field.
244      * defined runtimes
245      * @return This builder.
246      */
247    public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder clearRuntimes() {
248      runtimes = null;
249      fieldSetFlags()[1] = false;
250      return this;
251    }
252
253    @Override
254    public AvroMultiRuntimeDefinition build() {
255      try {
256        AvroMultiRuntimeDefinition record = new AvroMultiRuntimeDefinition();
257        record.defaultRuntimeName = fieldSetFlags()[0] ? this.defaultRuntimeName : (java.lang.CharSequence) defaultValue(fields()[0]);
258        record.runtimes = fieldSetFlags()[1] ? this.runtimes : (java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition>) defaultValue(fields()[1]);
259        return record;
260      } catch (Exception e) {
261        throw new org.apache.avro.AvroRuntimeException(e);
262      }
263    }
264  }
265
266  private static final org.apache.avro.io.DatumWriter
267    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
268
269  @Override public void writeExternal(java.io.ObjectOutput out)
270    throws java.io.IOException {
271    WRITER$.write(this, SpecificData.getEncoder(out));
272  }
273
274  private static final org.apache.avro.io.DatumReader
275    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
276
277  @Override public void readExternal(java.io.ObjectInput in)
278    throws java.io.IOException {
279    READER$.read(this, SpecificData.getDecoder(in));
280  }
281
282}