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.bridge.message;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011/** Identifies the following message in the Java/C# bridge protocol. */
012@org.apache.avro.specific.AvroGenerated
013public class Header extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
014  private static final long serialVersionUID = -6292011468399848487L;
015  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Header\",\"namespace\":\"org.apache.reef.bridge.message\",\"doc\":\"Identifies the following message in the Java/C# bridge protocol.\",\"fields\":[{\"name\":\"identifier\",\"type\":\"long\",\"doc\":\"Identifier of the next message to be read.\"},{\"name\":\"className\",\"type\":\"string\",\"doc\":\"The fully qualified name of the message class.\"}]}");
016  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
017  /** Identifier of the next message to be read. */
018  @Deprecated public long identifier;
019  /** The fully qualified name of the message class. */
020  @Deprecated public java.lang.CharSequence className;
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 Header() {}
028
029  /**
030   * All-args constructor.
031   * @param identifier Identifier of the next message to be read.
032   * @param className The fully qualified name of the message class.
033   */
034  public Header(java.lang.Long identifier, java.lang.CharSequence className) {
035    this.identifier = identifier;
036    this.className = className;
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 identifier;
044    case 1: return className;
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: identifier = (java.lang.Long)value$; break;
054    case 1: className = (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 'identifier' field.
061   * @return Identifier of the next message to be read.
062   */
063  public java.lang.Long getIdentifier() {
064    return identifier;
065  }
066
067  /**
068   * Sets the value of the 'identifier' field.
069   * Identifier of the next message to be read.
070   * @param value the value to set.
071   */
072  public void setIdentifier(java.lang.Long value) {
073    this.identifier = value;
074  }
075
076  /**
077   * Gets the value of the 'className' field.
078   * @return The fully qualified name of the message class.
079   */
080  public java.lang.CharSequence getClassName() {
081    return className;
082  }
083
084  /**
085   * Sets the value of the 'className' field.
086   * The fully qualified name of the message class.
087   * @param value the value to set.
088   */
089  public void setClassName(java.lang.CharSequence value) {
090    this.className = value;
091  }
092
093  /**
094   * Creates a new Header RecordBuilder.
095   * @return A new Header RecordBuilder
096   */
097  public static org.apache.reef.bridge.message.Header.Builder newBuilder() {
098    return new org.apache.reef.bridge.message.Header.Builder();
099  }
100
101  /**
102   * Creates a new Header RecordBuilder by copying an existing Builder.
103   * @param other The existing builder to copy.
104   * @return A new Header RecordBuilder
105   */
106  public static org.apache.reef.bridge.message.Header.Builder newBuilder(org.apache.reef.bridge.message.Header.Builder other) {
107    return new org.apache.reef.bridge.message.Header.Builder(other);
108  }
109
110  /**
111   * Creates a new Header RecordBuilder by copying an existing Header instance.
112   * @param other The existing instance to copy.
113   * @return A new Header RecordBuilder
114   */
115  public static org.apache.reef.bridge.message.Header.Builder newBuilder(org.apache.reef.bridge.message.Header other) {
116    return new org.apache.reef.bridge.message.Header.Builder(other);
117  }
118
119  /**
120   * RecordBuilder for Header instances.
121   */
122  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Header>
123    implements org.apache.avro.data.RecordBuilder<Header> {
124
125    /** Identifier of the next message to be read. */
126    private long identifier;
127    /** The fully qualified name of the message class. */
128    private java.lang.CharSequence className;
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.bridge.message.Header.Builder other) {
140      super(other);
141      if (isValidValue(fields()[0], other.identifier)) {
142        this.identifier = data().deepCopy(fields()[0].schema(), other.identifier);
143        fieldSetFlags()[0] = true;
144      }
145      if (isValidValue(fields()[1], other.className)) {
146        this.className = data().deepCopy(fields()[1].schema(), other.className);
147        fieldSetFlags()[1] = true;
148      }
149    }
150
151    /**
152     * Creates a Builder by copying an existing Header instance
153     * @param other The existing instance to copy.
154     */
155    private Builder(org.apache.reef.bridge.message.Header other) {
156            super(SCHEMA$);
157      if (isValidValue(fields()[0], other.identifier)) {
158        this.identifier = data().deepCopy(fields()[0].schema(), other.identifier);
159        fieldSetFlags()[0] = true;
160      }
161      if (isValidValue(fields()[1], other.className)) {
162        this.className = data().deepCopy(fields()[1].schema(), other.className);
163        fieldSetFlags()[1] = true;
164      }
165    }
166
167    /**
168      * Gets the value of the 'identifier' field.
169      * Identifier of the next message to be read.
170      * @return The value.
171      */
172    public java.lang.Long getIdentifier() {
173      return identifier;
174    }
175
176    /**
177      * Sets the value of the 'identifier' field.
178      * Identifier of the next message to be read.
179      * @param value The value of 'identifier'.
180      * @return This builder.
181      */
182    public org.apache.reef.bridge.message.Header.Builder setIdentifier(long value) {
183      validate(fields()[0], value);
184      this.identifier = value;
185      fieldSetFlags()[0] = true;
186      return this;
187    }
188
189    /**
190      * Checks whether the 'identifier' field has been set.
191      * Identifier of the next message to be read.
192      * @return True if the 'identifier' field has been set, false otherwise.
193      */
194    public boolean hasIdentifier() {
195      return fieldSetFlags()[0];
196    }
197
198
199    /**
200      * Clears the value of the 'identifier' field.
201      * Identifier of the next message to be read.
202      * @return This builder.
203      */
204    public org.apache.reef.bridge.message.Header.Builder clearIdentifier() {
205      fieldSetFlags()[0] = false;
206      return this;
207    }
208
209    /**
210      * Gets the value of the 'className' field.
211      * The fully qualified name of the message class.
212      * @return The value.
213      */
214    public java.lang.CharSequence getClassName() {
215      return className;
216    }
217
218    /**
219      * Sets the value of the 'className' field.
220      * The fully qualified name of the message class.
221      * @param value The value of 'className'.
222      * @return This builder.
223      */
224    public org.apache.reef.bridge.message.Header.Builder setClassName(java.lang.CharSequence value) {
225      validate(fields()[1], value);
226      this.className = value;
227      fieldSetFlags()[1] = true;
228      return this;
229    }
230
231    /**
232      * Checks whether the 'className' field has been set.
233      * The fully qualified name of the message class.
234      * @return True if the 'className' field has been set, false otherwise.
235      */
236    public boolean hasClassName() {
237      return fieldSetFlags()[1];
238    }
239
240
241    /**
242      * Clears the value of the 'className' field.
243      * The fully qualified name of the message class.
244      * @return This builder.
245      */
246    public org.apache.reef.bridge.message.Header.Builder clearClassName() {
247      className = null;
248      fieldSetFlags()[1] = false;
249      return this;
250    }
251
252    @Override
253    public Header build() {
254      try {
255        Header record = new Header();
256        record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.Long) defaultValue(fields()[0]);
257        record.className = fieldSetFlags()[1] ? this.className : (java.lang.CharSequence) defaultValue(fields()[1]);
258        return record;
259      } catch (Exception e) {
260        throw new org.apache.avro.AvroRuntimeException(e);
261      }
262    }
263  }
264
265  private static final org.apache.avro.io.DatumWriter
266    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
267
268  @Override public void writeExternal(java.io.ObjectOutput out)
269    throws java.io.IOException {
270    WRITER$.write(this, SpecificData.getEncoder(out));
271  }
272
273  private static final org.apache.avro.io.DatumReader
274    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
275
276  @Override public void readExternal(java.io.ObjectInput in)
277    throws java.io.IOException {
278    READER$.read(this, SpecificData.getDecoder(in));
279  }
280
281}