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