001/**
002 * Autogenerated by Avro
003 * 
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.tang.formats.avro;  
007@SuppressWarnings("all")
008@org.apache.avro.specific.AvroGenerated
009public class AvroConfiguration extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
010  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\"}]}}}]}");
011  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
012  @Deprecated public java.lang.CharSequence language;
013  @Deprecated public java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> Bindings;
014
015  /**
016   * Default constructor.  Note that this does not initialize fields
017   * to their default values from the schema.  If that is desired then
018   * one should use <code>newBuilder()</code>. 
019   */
020  public AvroConfiguration() {}
021
022  /**
023   * All-args constructor.
024   */
025  public AvroConfiguration(java.lang.CharSequence language, java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> Bindings) {
026    this.language = language;
027    this.Bindings = Bindings;
028  }
029
030  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
031  // Used by DatumWriter.  Applications should not call. 
032  public java.lang.Object get(int field$) {
033    switch (field$) {
034    case 0: return language;
035    case 1: return Bindings;
036    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
037    }
038  }
039  // Used by DatumReader.  Applications should not call. 
040  @SuppressWarnings(value="unchecked")
041  public void put(int field$, java.lang.Object value$) {
042    switch (field$) {
043    case 0: language = (java.lang.CharSequence)value$; break;
044    case 1: Bindings = (java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry>)value$; break;
045    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
046    }
047  }
048
049  /**
050   * Gets the value of the 'language' field.
051   */
052  public java.lang.CharSequence getLanguage() {
053    return language;
054  }
055
056  /**
057   * Sets the value of the 'language' field.
058   * @param value the value to set.
059   */
060  public void setLanguage(java.lang.CharSequence value) {
061    this.language = value;
062  }
063
064  /**
065   * Gets the value of the 'Bindings' field.
066   */
067  public java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> getBindings() {
068    return Bindings;
069  }
070
071  /**
072   * Sets the value of the 'Bindings' field.
073   * @param value the value to set.
074   */
075  public void setBindings(java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> value) {
076    this.Bindings = value;
077  }
078
079  /** Creates a new AvroConfiguration RecordBuilder */
080  public static org.apache.reef.tang.formats.avro.AvroConfiguration.Builder newBuilder() {
081    return new org.apache.reef.tang.formats.avro.AvroConfiguration.Builder();
082  }
083  
084  /** Creates a new AvroConfiguration RecordBuilder by copying an existing Builder */
085  public static org.apache.reef.tang.formats.avro.AvroConfiguration.Builder newBuilder(org.apache.reef.tang.formats.avro.AvroConfiguration.Builder other) {
086    return new org.apache.reef.tang.formats.avro.AvroConfiguration.Builder(other);
087  }
088  
089  /** Creates a new AvroConfiguration RecordBuilder by copying an existing AvroConfiguration instance */
090  public static org.apache.reef.tang.formats.avro.AvroConfiguration.Builder newBuilder(org.apache.reef.tang.formats.avro.AvroConfiguration other) {
091    return new org.apache.reef.tang.formats.avro.AvroConfiguration.Builder(other);
092  }
093  
094  /**
095   * RecordBuilder for AvroConfiguration instances.
096   */
097  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroConfiguration>
098    implements org.apache.avro.data.RecordBuilder<AvroConfiguration> {
099
100    private java.lang.CharSequence language;
101    private java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> Bindings;
102
103    /** Creates a new Builder */
104    private Builder() {
105      super(org.apache.reef.tang.formats.avro.AvroConfiguration.SCHEMA$);
106    }
107    
108    /** Creates a Builder by copying an existing Builder */
109    private Builder(org.apache.reef.tang.formats.avro.AvroConfiguration.Builder other) {
110      super(other);
111      if (isValidValue(fields()[0], other.language)) {
112        this.language = data().deepCopy(fields()[0].schema(), other.language);
113        fieldSetFlags()[0] = true;
114      }
115      if (isValidValue(fields()[1], other.Bindings)) {
116        this.Bindings = data().deepCopy(fields()[1].schema(), other.Bindings);
117        fieldSetFlags()[1] = true;
118      }
119    }
120    
121    /** Creates a Builder by copying an existing AvroConfiguration instance */
122    private Builder(org.apache.reef.tang.formats.avro.AvroConfiguration other) {
123            super(org.apache.reef.tang.formats.avro.AvroConfiguration.SCHEMA$);
124      if (isValidValue(fields()[0], other.language)) {
125        this.language = data().deepCopy(fields()[0].schema(), other.language);
126        fieldSetFlags()[0] = true;
127      }
128      if (isValidValue(fields()[1], other.Bindings)) {
129        this.Bindings = data().deepCopy(fields()[1].schema(), other.Bindings);
130        fieldSetFlags()[1] = true;
131      }
132    }
133
134    /** Gets the value of the 'language' field */
135    public java.lang.CharSequence getLanguage() {
136      return language;
137    }
138    
139    /** Sets the value of the 'language' field */
140    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder setLanguage(java.lang.CharSequence value) {
141      validate(fields()[0], value);
142      this.language = value;
143      fieldSetFlags()[0] = true;
144      return this; 
145    }
146    
147    /** Checks whether the 'language' field has been set */
148    public boolean hasLanguage() {
149      return fieldSetFlags()[0];
150    }
151    
152    /** Clears the value of the 'language' field */
153    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder clearLanguage() {
154      language = null;
155      fieldSetFlags()[0] = false;
156      return this;
157    }
158
159    /** Gets the value of the 'Bindings' field */
160    public java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> getBindings() {
161      return Bindings;
162    }
163    
164    /** Sets the value of the 'Bindings' field */
165    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder setBindings(java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry> value) {
166      validate(fields()[1], value);
167      this.Bindings = value;
168      fieldSetFlags()[1] = true;
169      return this; 
170    }
171    
172    /** Checks whether the 'Bindings' field has been set */
173    public boolean hasBindings() {
174      return fieldSetFlags()[1];
175    }
176    
177    /** Clears the value of the 'Bindings' field */
178    public org.apache.reef.tang.formats.avro.AvroConfiguration.Builder clearBindings() {
179      Bindings = null;
180      fieldSetFlags()[1] = false;
181      return this;
182    }
183
184    @Override
185    public AvroConfiguration build() {
186      try {
187        AvroConfiguration record = new AvroConfiguration();
188        record.language = fieldSetFlags()[0] ? this.language : (java.lang.CharSequence) defaultValue(fields()[0]);
189        record.Bindings = fieldSetFlags()[1] ? this.Bindings : (java.util.List<org.apache.reef.tang.formats.avro.ConfigurationEntry>) defaultValue(fields()[1]);
190        return record;
191      } catch (Exception e) {
192        throw new org.apache.avro.AvroRuntimeException(e);
193      }
194    }
195  }
196}