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.tang.formats.avro;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroConfiguration extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -7544018313751459657L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroConfiguration\",\"namespace\":\"org.apache.reef.tang.formats.avro\",\"fields\":[{\"name\":\"language\",\"type\":\"string\"},{\"name\":\"Bindings\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ConfigurationEntry\",\"fields\":[{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"}]}}}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.lang.CharSequence language;
017  @Deprecated public java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> Bindings;
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 AvroConfiguration() {}
025
026  /**
027   * All-args constructor.
028   * @param language The new value for language
029   * @param Bindings The new value for Bindings
030   */
031  public AvroConfiguration(java.lang.CharSequence language, java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> Bindings) {
032    this.language = language;
033    this.Bindings = Bindings;
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 language;
041    case 1: return Bindings;
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: language = (java.lang.CharSequence)value$; break;
051    case 1: Bindings = (java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry>)value$; break;
052    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
053    }
054  }
055
056  /**
057   * Gets the value of the 'language' field.
058   * @return The value of the 'language' field.
059   */
060  public java.lang.CharSequence getLanguage() {
061    return language;
062  }
063
064  /**
065   * Sets the value of the 'language' field.
066   * @param value the value to set.
067   */
068  public void setLanguage(java.lang.CharSequence value) {
069    this.language = value;
070  }
071
072  /**
073   * Gets the value of the 'Bindings' field.
074   * @return The value of the 'Bindings' field.
075   */
076  public java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> getBindings() {
077    return Bindings;
078  }
079
080  /**
081   * Sets the value of the 'Bindings' field.
082   * @param value the value to set.
083   */
084  public void setBindings(java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> value) {
085    this.Bindings = value;
086  }
087
088  /**
089   * Creates a new AvroConfiguration RecordBuilder.
090   * @return A new AvroConfiguration RecordBuilder
091   */
092  public static org.apache.reef.tang.formats.avro.AvroConfiguration.Builder newBuilder() {
093    return new org.apache.reef.tang.formats.avro.AvroConfiguration.Builder();
094  }
095
096  /**
097   * Creates a new AvroConfiguration RecordBuilder by copying an existing Builder.
098   * @param other The existing builder to copy.
099   * @return A new AvroConfiguration RecordBuilder
100   */
101  public static org.apache.reef.tang.formats.avro.AvroConfiguration.Builder newBuilder(org.apache.reef.tang.formats.avro.AvroConfiguration.Builder other) {
102    return new org.apache.reef.tang.formats.avro.AvroConfiguration.Builder(other);
103  }
104
105  /**
106   * Creates a new AvroConfiguration RecordBuilder by copying an existing AvroConfiguration instance.
107   * @param other The existing instance to copy.
108   * @return A new AvroConfiguration RecordBuilder
109   */
110  public static org.apache.reef.tang.formats.avro.AvroConfiguration.Builder newBuilder(org.apache.reef.tang.formats.avro.AvroConfiguration other) {
111    return new org.apache.reef.tang.formats.avro.AvroConfiguration.Builder(other);
112  }
113
114  /**
115   * RecordBuilder for AvroConfiguration instances.
116   */
117  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroConfiguration>
118    implements org.apache.avro.data.RecordBuilder<AvroConfiguration> {
119
120    private java.lang.CharSequence language;
121    private java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> Bindings;
122
123    /** Creates a new Builder */
124    private Builder() {
125      super(SCHEMA$);
126    }
127
128    /**
129     * Creates a Builder by copying an existing Builder.
130     * @param other The existing Builder to copy.
131     */
132    private Builder(org.apache.reef.tang.formats.avro.AvroConfiguration.Builder other) {
133      super(other);
134      if (isValidValue(fields()[0], other.language)) {
135        this.language = data().deepCopy(fields()[0].schema(), other.language);
136        fieldSetFlags()[0] = true;
137      }
138      if (isValidValue(fields()[1], other.Bindings)) {
139        this.Bindings = data().deepCopy(fields()[1].schema(), other.Bindings);
140        fieldSetFlags()[1] = true;
141      }
142    }
143
144    /**
145     * Creates a Builder by copying an existing AvroConfiguration instance
146     * @param other The existing instance to copy.
147     */
148    private Builder(org.apache.reef.tang.formats.avro.AvroConfiguration other) {
149            super(SCHEMA$);
150      if (isValidValue(fields()[0], other.language)) {
151        this.language = data().deepCopy(fields()[0].schema(), other.language);
152        fieldSetFlags()[0] = true;
153      }
154      if (isValidValue(fields()[1], other.Bindings)) {
155        this.Bindings = data().deepCopy(fields()[1].schema(), other.Bindings);
156        fieldSetFlags()[1] = true;
157      }
158    }
159
160    /**
161      * Gets the value of the 'language' field.
162      * @return The value.
163      */
164    public java.lang.CharSequence getLanguage() {
165      return language;
166    }
167
168    /**
169      * Sets the value of the 'language' field.
170      * @param value The value of 'language'.
171      * @return This builder.
172      */
173    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder setLanguage(java.lang.CharSequence value) {
174      validate(fields()[0], value);
175      this.language = value;
176      fieldSetFlags()[0] = true;
177      return this;
178    }
179
180    /**
181      * Checks whether the 'language' field has been set.
182      * @return True if the 'language' field has been set, false otherwise.
183      */
184    public boolean hasLanguage() {
185      return fieldSetFlags()[0];
186    }
187
188
189    /**
190      * Clears the value of the 'language' field.
191      * @return This builder.
192      */
193    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder clearLanguage() {
194      language = null;
195      fieldSetFlags()[0] = false;
196      return this;
197    }
198
199    /**
200      * Gets the value of the 'Bindings' field.
201      * @return The value.
202      */
203    public java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> getBindings() {
204      return Bindings;
205    }
206
207    /**
208      * Sets the value of the 'Bindings' field.
209      * @param value The value of 'Bindings'.
210      * @return This builder.
211      */
212    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder setBindings(java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> value) {
213      validate(fields()[1], value);
214      this.Bindings = value;
215      fieldSetFlags()[1] = true;
216      return this;
217    }
218
219    /**
220      * Checks whether the 'Bindings' field has been set.
221      * @return True if the 'Bindings' field has been set, false otherwise.
222      */
223    public boolean hasBindings() {
224      return fieldSetFlags()[1];
225    }
226
227
228    /**
229      * Clears the value of the 'Bindings' field.
230      * @return This builder.
231      */
232    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder clearBindings() {
233      Bindings = null;
234      fieldSetFlags()[1] = false;
235      return this;
236    }
237
238    @Override
239    public AvroConfiguration build() {
240      try {
241        AvroConfiguration record = new AvroConfiguration();
242        record.language = fieldSetFlags()[0] ? this.language : (java.lang.CharSequence) defaultValue(fields()[0]);
243        record.Bindings = fieldSetFlags()[1] ? this.Bindings : (java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry>) defaultValue(fields()[1]);
244        return record;
245      } catch (Exception e) {
246        throw new org.apache.avro.AvroRuntimeException(e);
247      }
248    }
249  }
250
251  private static final org.apache.avro.io.DatumWriter
252    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
253
254  @Override public void writeExternal(java.io.ObjectOutput out)
255    throws java.io.IOException {
256    WRITER$.write(this, SpecificData.getEncoder(out));
257  }
258
259  private static final org.apache.avro.io.DatumReader
260    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
261
262  @Override public void readExternal(java.io.ObjectInput in)
263    throws java.io.IOException {
264    READER$.read(this, SpecificData.getDecoder(in));
265  }
266
267}