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 runtime definition. This avro object is used to pass runtimes definitions to the runtimes host */
012@org.apache.avro.specific.AvroGenerated
013public class AvroRuntimeDefinition extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
014  private static final long serialVersionUID = -7864389238298868383L;
015  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroRuntimeDefinition\",\"namespace\":\"org.apache.reef.runtime.multi.utils.avro\",\"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\"}]}");
016  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
017  /** The name of the runtime, that will be provided with the resource allocation requests */
018  @Deprecated public java.lang.CharSequence runtimeName;
019  /** Serialized Tang configuration */
020  @Deprecated public java.lang.CharSequence serializedConfiguration;
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 AvroRuntimeDefinition() {}
028
029  /**
030   * All-args constructor.
031   * @param runtimeName The name of the runtime, that will be provided with the resource allocation requests
032   * @param serializedConfiguration Serialized Tang configuration
033   */
034  public AvroRuntimeDefinition(java.lang.CharSequence runtimeName, java.lang.CharSequence serializedConfiguration) {
035    this.runtimeName = runtimeName;
036    this.serializedConfiguration = serializedConfiguration;
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 runtimeName;
044    case 1: return serializedConfiguration;
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: runtimeName = (java.lang.CharSequence)value$; break;
054    case 1: serializedConfiguration = (java.lang.CharSequence)value$; break;
055    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
056    }
057  }
058
059  /**
060   * Gets the value of the 'runtimeName' field.
061   * @return The name of the runtime, that will be provided with the resource allocation requests
062   */
063  public java.lang.CharSequence getRuntimeName() {
064    return runtimeName;
065  }
066
067  /**
068   * Sets the value of the 'runtimeName' field.
069   * The name of the runtime, that will be provided with the resource allocation requests
070   * @param value the value to set.
071   */
072  public void setRuntimeName(java.lang.CharSequence value) {
073    this.runtimeName = value;
074  }
075
076  /**
077   * Gets the value of the 'serializedConfiguration' field.
078   * @return Serialized Tang configuration
079   */
080  public java.lang.CharSequence getSerializedConfiguration() {
081    return serializedConfiguration;
082  }
083
084  /**
085   * Sets the value of the 'serializedConfiguration' field.
086   * Serialized Tang configuration
087   * @param value the value to set.
088   */
089  public void setSerializedConfiguration(java.lang.CharSequence value) {
090    this.serializedConfiguration = value;
091  }
092
093  /**
094   * Creates a new AvroRuntimeDefinition RecordBuilder.
095   * @return A new AvroRuntimeDefinition RecordBuilder
096   */
097  public static org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder newBuilder() {
098    return new org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder();
099  }
100
101  /**
102   * Creates a new AvroRuntimeDefinition RecordBuilder by copying an existing Builder.
103   * @param other The existing builder to copy.
104   * @return A new AvroRuntimeDefinition RecordBuilder
105   */
106  public static org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder other) {
107    return new org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder(other);
108  }
109
110  /**
111   * Creates a new AvroRuntimeDefinition RecordBuilder by copying an existing AvroRuntimeDefinition instance.
112   * @param other The existing instance to copy.
113   * @return A new AvroRuntimeDefinition RecordBuilder
114   */
115  public static org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition other) {
116    return new org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder(other);
117  }
118
119  /**
120   * RecordBuilder for AvroRuntimeDefinition instances.
121   */
122  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroRuntimeDefinition>
123    implements org.apache.avro.data.RecordBuilder<AvroRuntimeDefinition> {
124
125    /** The name of the runtime, that will be provided with the resource allocation requests */
126    private java.lang.CharSequence runtimeName;
127    /** Serialized Tang configuration */
128    private java.lang.CharSequence serializedConfiguration;
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.AvroRuntimeDefinition.Builder other) {
140      super(other);
141      if (isValidValue(fields()[0], other.runtimeName)) {
142        this.runtimeName = data().deepCopy(fields()[0].schema(), other.runtimeName);
143        fieldSetFlags()[0] = true;
144      }
145      if (isValidValue(fields()[1], other.serializedConfiguration)) {
146        this.serializedConfiguration = data().deepCopy(fields()[1].schema(), other.serializedConfiguration);
147        fieldSetFlags()[1] = true;
148      }
149    }
150
151    /**
152     * Creates a Builder by copying an existing AvroRuntimeDefinition instance
153     * @param other The existing instance to copy.
154     */
155    private Builder(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition other) {
156            super(SCHEMA$);
157      if (isValidValue(fields()[0], other.runtimeName)) {
158        this.runtimeName = data().deepCopy(fields()[0].schema(), other.runtimeName);
159        fieldSetFlags()[0] = true;
160      }
161      if (isValidValue(fields()[1], other.serializedConfiguration)) {
162        this.serializedConfiguration = data().deepCopy(fields()[1].schema(), other.serializedConfiguration);
163        fieldSetFlags()[1] = true;
164      }
165    }
166
167    /**
168      * Gets the value of the 'runtimeName' field.
169      * The name of the runtime, that will be provided with the resource allocation requests
170      * @return The value.
171      */
172    public java.lang.CharSequence getRuntimeName() {
173      return runtimeName;
174    }
175
176    /**
177      * Sets the value of the 'runtimeName' field.
178      * The name of the runtime, that will be provided with the resource allocation requests
179      * @param value The value of 'runtimeName'.
180      * @return This builder.
181      */
182    public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder setRuntimeName(java.lang.CharSequence value) {
183      validate(fields()[0], value);
184      this.runtimeName = value;
185      fieldSetFlags()[0] = true;
186      return this;
187    }
188
189    /**
190      * Checks whether the 'runtimeName' field has been set.
191      * The name of the runtime, that will be provided with the resource allocation requests
192      * @return True if the 'runtimeName' field has been set, false otherwise.
193      */
194    public boolean hasRuntimeName() {
195      return fieldSetFlags()[0];
196    }
197
198
199    /**
200      * Clears the value of the 'runtimeName' field.
201      * The name of the runtime, that will be provided with the resource allocation requests
202      * @return This builder.
203      */
204    public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder clearRuntimeName() {
205      runtimeName = null;
206      fieldSetFlags()[0] = false;
207      return this;
208    }
209
210    /**
211      * Gets the value of the 'serializedConfiguration' field.
212      * Serialized Tang configuration
213      * @return The value.
214      */
215    public java.lang.CharSequence getSerializedConfiguration() {
216      return serializedConfiguration;
217    }
218
219    /**
220      * Sets the value of the 'serializedConfiguration' field.
221      * Serialized Tang configuration
222      * @param value The value of 'serializedConfiguration'.
223      * @return This builder.
224      */
225    public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder setSerializedConfiguration(java.lang.CharSequence value) {
226      validate(fields()[1], value);
227      this.serializedConfiguration = value;
228      fieldSetFlags()[1] = true;
229      return this;
230    }
231
232    /**
233      * Checks whether the 'serializedConfiguration' field has been set.
234      * Serialized Tang configuration
235      * @return True if the 'serializedConfiguration' field has been set, false otherwise.
236      */
237    public boolean hasSerializedConfiguration() {
238      return fieldSetFlags()[1];
239    }
240
241
242    /**
243      * Clears the value of the 'serializedConfiguration' field.
244      * Serialized Tang configuration
245      * @return This builder.
246      */
247    public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder clearSerializedConfiguration() {
248      serializedConfiguration = null;
249      fieldSetFlags()[1] = false;
250      return this;
251    }
252
253    @Override
254    public AvroRuntimeDefinition build() {
255      try {
256        AvroRuntimeDefinition record = new AvroRuntimeDefinition();
257        record.runtimeName = fieldSetFlags()[0] ? this.runtimeName : (java.lang.CharSequence) defaultValue(fields()[0]);
258        record.serializedConfiguration = fieldSetFlags()[1] ? this.serializedConfiguration : (java.lang.CharSequence) 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}