001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.webserver;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroHttpRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -3314313793478582565L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroHttpRequest\",\"namespace\":\"org.apache.reef.webserver\",\"fields\":[{\"name\":\"header\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"HeaderEntry\",\"fields\":[{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"}]}}},{\"name\":\"requestUrl\",\"type\":\"string\"},{\"name\":\"pathInfo\",\"type\":\"string\"},{\"name\":\"queryString\",\"type\":\"string\"},{\"name\":\"httpMethod\",\"type\":\"string\"},{\"name\":\"inputStream\",\"type\":\"bytes\"}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.util.List<org.apache.reef.webserver.HeaderEntry> header;
017  @Deprecated public java.lang.CharSequence requestUrl;
018  @Deprecated public java.lang.CharSequence pathInfo;
019  @Deprecated public java.lang.CharSequence queryString;
020  @Deprecated public java.lang.CharSequence httpMethod;
021  @Deprecated public java.nio.ByteBuffer inputStream;
022
023  /**
024   * Default constructor.  Note that this does not initialize fields
025   * to their default values from the schema.  If that is desired then
026   * one should use <code>newBuilder()</code>.
027   */
028  public AvroHttpRequest() {}
029
030  /**
031   * All-args constructor.
032   * @param header The new value for header
033   * @param requestUrl The new value for requestUrl
034   * @param pathInfo The new value for pathInfo
035   * @param queryString The new value for queryString
036   * @param httpMethod The new value for httpMethod
037   * @param inputStream The new value for inputStream
038   */
039  public AvroHttpRequest(java.util.List<org.apache.reef.webserver.HeaderEntry> header, java.lang.CharSequence requestUrl, java.lang.CharSequence pathInfo, java.lang.CharSequence queryString, java.lang.CharSequence httpMethod, java.nio.ByteBuffer inputStream) {
040    this.header = header;
041    this.requestUrl = requestUrl;
042    this.pathInfo = pathInfo;
043    this.queryString = queryString;
044    this.httpMethod = httpMethod;
045    this.inputStream = inputStream;
046  }
047
048  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
049  // Used by DatumWriter.  Applications should not call.
050  public java.lang.Object get(int field$) {
051    switch (field$) {
052    case 0: return header;
053    case 1: return requestUrl;
054    case 2: return pathInfo;
055    case 3: return queryString;
056    case 4: return httpMethod;
057    case 5: return inputStream;
058    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
059    }
060  }
061
062  // Used by DatumReader.  Applications should not call.
063  @SuppressWarnings(value="unchecked")
064  public void put(int field$, java.lang.Object value$) {
065    switch (field$) {
066    case 0: header = (java.util.List<org.apache.reef.webserver.HeaderEntry>)value$; break;
067    case 1: requestUrl = (java.lang.CharSequence)value$; break;
068    case 2: pathInfo = (java.lang.CharSequence)value$; break;
069    case 3: queryString = (java.lang.CharSequence)value$; break;
070    case 4: httpMethod = (java.lang.CharSequence)value$; break;
071    case 5: inputStream = (java.nio.ByteBuffer)value$; break;
072    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
073    }
074  }
075
076  /**
077   * Gets the value of the 'header' field.
078   * @return The value of the 'header' field.
079   */
080  public java.util.List<org.apache.reef.webserver.HeaderEntry> getHeader() {
081    return header;
082  }
083
084  /**
085   * Sets the value of the 'header' field.
086   * @param value the value to set.
087   */
088  public void setHeader(java.util.List<org.apache.reef.webserver.HeaderEntry> value) {
089    this.header = value;
090  }
091
092  /**
093   * Gets the value of the 'requestUrl' field.
094   * @return The value of the 'requestUrl' field.
095   */
096  public java.lang.CharSequence getRequestUrl() {
097    return requestUrl;
098  }
099
100  /**
101   * Sets the value of the 'requestUrl' field.
102   * @param value the value to set.
103   */
104  public void setRequestUrl(java.lang.CharSequence value) {
105    this.requestUrl = value;
106  }
107
108  /**
109   * Gets the value of the 'pathInfo' field.
110   * @return The value of the 'pathInfo' field.
111   */
112  public java.lang.CharSequence getPathInfo() {
113    return pathInfo;
114  }
115
116  /**
117   * Sets the value of the 'pathInfo' field.
118   * @param value the value to set.
119   */
120  public void setPathInfo(java.lang.CharSequence value) {
121    this.pathInfo = value;
122  }
123
124  /**
125   * Gets the value of the 'queryString' field.
126   * @return The value of the 'queryString' field.
127   */
128  public java.lang.CharSequence getQueryString() {
129    return queryString;
130  }
131
132  /**
133   * Sets the value of the 'queryString' field.
134   * @param value the value to set.
135   */
136  public void setQueryString(java.lang.CharSequence value) {
137    this.queryString = value;
138  }
139
140  /**
141   * Gets the value of the 'httpMethod' field.
142   * @return The value of the 'httpMethod' field.
143   */
144  public java.lang.CharSequence getHttpMethod() {
145    return httpMethod;
146  }
147
148  /**
149   * Sets the value of the 'httpMethod' field.
150   * @param value the value to set.
151   */
152  public void setHttpMethod(java.lang.CharSequence value) {
153    this.httpMethod = value;
154  }
155
156  /**
157   * Gets the value of the 'inputStream' field.
158   * @return The value of the 'inputStream' field.
159   */
160  public java.nio.ByteBuffer getInputStream() {
161    return inputStream;
162  }
163
164  /**
165   * Sets the value of the 'inputStream' field.
166   * @param value the value to set.
167   */
168  public void setInputStream(java.nio.ByteBuffer value) {
169    this.inputStream = value;
170  }
171
172  /**
173   * Creates a new AvroHttpRequest RecordBuilder.
174   * @return A new AvroHttpRequest RecordBuilder
175   */
176  public static org.apache.reef.webserver.AvroHttpRequest.Builder newBuilder() {
177    return new org.apache.reef.webserver.AvroHttpRequest.Builder();
178  }
179
180  /**
181   * Creates a new AvroHttpRequest RecordBuilder by copying an existing Builder.
182   * @param other The existing builder to copy.
183   * @return A new AvroHttpRequest RecordBuilder
184   */
185  public static org.apache.reef.webserver.AvroHttpRequest.Builder newBuilder(org.apache.reef.webserver.AvroHttpRequest.Builder other) {
186    return new org.apache.reef.webserver.AvroHttpRequest.Builder(other);
187  }
188
189  /**
190   * Creates a new AvroHttpRequest RecordBuilder by copying an existing AvroHttpRequest instance.
191   * @param other The existing instance to copy.
192   * @return A new AvroHttpRequest RecordBuilder
193   */
194  public static org.apache.reef.webserver.AvroHttpRequest.Builder newBuilder(org.apache.reef.webserver.AvroHttpRequest other) {
195    return new org.apache.reef.webserver.AvroHttpRequest.Builder(other);
196  }
197
198  /**
199   * RecordBuilder for AvroHttpRequest instances.
200   */
201  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroHttpRequest>
202    implements org.apache.avro.data.RecordBuilder<AvroHttpRequest> {
203
204    private java.util.List<org.apache.reef.webserver.HeaderEntry> header;
205    private java.lang.CharSequence requestUrl;
206    private java.lang.CharSequence pathInfo;
207    private java.lang.CharSequence queryString;
208    private java.lang.CharSequence httpMethod;
209    private java.nio.ByteBuffer inputStream;
210
211    /** Creates a new Builder */
212    private Builder() {
213      super(SCHEMA$);
214    }
215
216    /**
217     * Creates a Builder by copying an existing Builder.
218     * @param other The existing Builder to copy.
219     */
220    private Builder(org.apache.reef.webserver.AvroHttpRequest.Builder other) {
221      super(other);
222      if (isValidValue(fields()[0], other.header)) {
223        this.header = data().deepCopy(fields()[0].schema(), other.header);
224        fieldSetFlags()[0] = true;
225      }
226      if (isValidValue(fields()[1], other.requestUrl)) {
227        this.requestUrl = data().deepCopy(fields()[1].schema(), other.requestUrl);
228        fieldSetFlags()[1] = true;
229      }
230      if (isValidValue(fields()[2], other.pathInfo)) {
231        this.pathInfo = data().deepCopy(fields()[2].schema(), other.pathInfo);
232        fieldSetFlags()[2] = true;
233      }
234      if (isValidValue(fields()[3], other.queryString)) {
235        this.queryString = data().deepCopy(fields()[3].schema(), other.queryString);
236        fieldSetFlags()[3] = true;
237      }
238      if (isValidValue(fields()[4], other.httpMethod)) {
239        this.httpMethod = data().deepCopy(fields()[4].schema(), other.httpMethod);
240        fieldSetFlags()[4] = true;
241      }
242      if (isValidValue(fields()[5], other.inputStream)) {
243        this.inputStream = data().deepCopy(fields()[5].schema(), other.inputStream);
244        fieldSetFlags()[5] = true;
245      }
246    }
247
248    /**
249     * Creates a Builder by copying an existing AvroHttpRequest instance
250     * @param other The existing instance to copy.
251     */
252    private Builder(org.apache.reef.webserver.AvroHttpRequest other) {
253            super(SCHEMA$);
254      if (isValidValue(fields()[0], other.header)) {
255        this.header = data().deepCopy(fields()[0].schema(), other.header);
256        fieldSetFlags()[0] = true;
257      }
258      if (isValidValue(fields()[1], other.requestUrl)) {
259        this.requestUrl = data().deepCopy(fields()[1].schema(), other.requestUrl);
260        fieldSetFlags()[1] = true;
261      }
262      if (isValidValue(fields()[2], other.pathInfo)) {
263        this.pathInfo = data().deepCopy(fields()[2].schema(), other.pathInfo);
264        fieldSetFlags()[2] = true;
265      }
266      if (isValidValue(fields()[3], other.queryString)) {
267        this.queryString = data().deepCopy(fields()[3].schema(), other.queryString);
268        fieldSetFlags()[3] = true;
269      }
270      if (isValidValue(fields()[4], other.httpMethod)) {
271        this.httpMethod = data().deepCopy(fields()[4].schema(), other.httpMethod);
272        fieldSetFlags()[4] = true;
273      }
274      if (isValidValue(fields()[5], other.inputStream)) {
275        this.inputStream = data().deepCopy(fields()[5].schema(), other.inputStream);
276        fieldSetFlags()[5] = true;
277      }
278    }
279
280    /**
281      * Gets the value of the 'header' field.
282      * @return The value.
283      */
284    public java.util.List<org.apache.reef.webserver.HeaderEntry> getHeader() {
285      return header;
286    }
287
288    /**
289      * Sets the value of the 'header' field.
290      * @param value The value of 'header'.
291      * @return This builder.
292      */
293    public org.apache.reef.webserver.AvroHttpRequest.Builder setHeader(java.util.List<org.apache.reef.webserver.HeaderEntry> value) {
294      validate(fields()[0], value);
295      this.header = value;
296      fieldSetFlags()[0] = true;
297      return this;
298    }
299
300    /**
301      * Checks whether the 'header' field has been set.
302      * @return True if the 'header' field has been set, false otherwise.
303      */
304    public boolean hasHeader() {
305      return fieldSetFlags()[0];
306    }
307
308
309    /**
310      * Clears the value of the 'header' field.
311      * @return This builder.
312      */
313    public org.apache.reef.webserver.AvroHttpRequest.Builder clearHeader() {
314      header = null;
315      fieldSetFlags()[0] = false;
316      return this;
317    }
318
319    /**
320      * Gets the value of the 'requestUrl' field.
321      * @return The value.
322      */
323    public java.lang.CharSequence getRequestUrl() {
324      return requestUrl;
325    }
326
327    /**
328      * Sets the value of the 'requestUrl' field.
329      * @param value The value of 'requestUrl'.
330      * @return This builder.
331      */
332    public org.apache.reef.webserver.AvroHttpRequest.Builder setRequestUrl(java.lang.CharSequence value) {
333      validate(fields()[1], value);
334      this.requestUrl = value;
335      fieldSetFlags()[1] = true;
336      return this;
337    }
338
339    /**
340      * Checks whether the 'requestUrl' field has been set.
341      * @return True if the 'requestUrl' field has been set, false otherwise.
342      */
343    public boolean hasRequestUrl() {
344      return fieldSetFlags()[1];
345    }
346
347
348    /**
349      * Clears the value of the 'requestUrl' field.
350      * @return This builder.
351      */
352    public org.apache.reef.webserver.AvroHttpRequest.Builder clearRequestUrl() {
353      requestUrl = null;
354      fieldSetFlags()[1] = false;
355      return this;
356    }
357
358    /**
359      * Gets the value of the 'pathInfo' field.
360      * @return The value.
361      */
362    public java.lang.CharSequence getPathInfo() {
363      return pathInfo;
364    }
365
366    /**
367      * Sets the value of the 'pathInfo' field.
368      * @param value The value of 'pathInfo'.
369      * @return This builder.
370      */
371    public org.apache.reef.webserver.AvroHttpRequest.Builder setPathInfo(java.lang.CharSequence value) {
372      validate(fields()[2], value);
373      this.pathInfo = value;
374      fieldSetFlags()[2] = true;
375      return this;
376    }
377
378    /**
379      * Checks whether the 'pathInfo' field has been set.
380      * @return True if the 'pathInfo' field has been set, false otherwise.
381      */
382    public boolean hasPathInfo() {
383      return fieldSetFlags()[2];
384    }
385
386
387    /**
388      * Clears the value of the 'pathInfo' field.
389      * @return This builder.
390      */
391    public org.apache.reef.webserver.AvroHttpRequest.Builder clearPathInfo() {
392      pathInfo = null;
393      fieldSetFlags()[2] = false;
394      return this;
395    }
396
397    /**
398      * Gets the value of the 'queryString' field.
399      * @return The value.
400      */
401    public java.lang.CharSequence getQueryString() {
402      return queryString;
403    }
404
405    /**
406      * Sets the value of the 'queryString' field.
407      * @param value The value of 'queryString'.
408      * @return This builder.
409      */
410    public org.apache.reef.webserver.AvroHttpRequest.Builder setQueryString(java.lang.CharSequence value) {
411      validate(fields()[3], value);
412      this.queryString = value;
413      fieldSetFlags()[3] = true;
414      return this;
415    }
416
417    /**
418      * Checks whether the 'queryString' field has been set.
419      * @return True if the 'queryString' field has been set, false otherwise.
420      */
421    public boolean hasQueryString() {
422      return fieldSetFlags()[3];
423    }
424
425
426    /**
427      * Clears the value of the 'queryString' field.
428      * @return This builder.
429      */
430    public org.apache.reef.webserver.AvroHttpRequest.Builder clearQueryString() {
431      queryString = null;
432      fieldSetFlags()[3] = false;
433      return this;
434    }
435
436    /**
437      * Gets the value of the 'httpMethod' field.
438      * @return The value.
439      */
440    public java.lang.CharSequence getHttpMethod() {
441      return httpMethod;
442    }
443
444    /**
445      * Sets the value of the 'httpMethod' field.
446      * @param value The value of 'httpMethod'.
447      * @return This builder.
448      */
449    public org.apache.reef.webserver.AvroHttpRequest.Builder setHttpMethod(java.lang.CharSequence value) {
450      validate(fields()[4], value);
451      this.httpMethod = value;
452      fieldSetFlags()[4] = true;
453      return this;
454    }
455
456    /**
457      * Checks whether the 'httpMethod' field has been set.
458      * @return True if the 'httpMethod' field has been set, false otherwise.
459      */
460    public boolean hasHttpMethod() {
461      return fieldSetFlags()[4];
462    }
463
464
465    /**
466      * Clears the value of the 'httpMethod' field.
467      * @return This builder.
468      */
469    public org.apache.reef.webserver.AvroHttpRequest.Builder clearHttpMethod() {
470      httpMethod = null;
471      fieldSetFlags()[4] = false;
472      return this;
473    }
474
475    /**
476      * Gets the value of the 'inputStream' field.
477      * @return The value.
478      */
479    public java.nio.ByteBuffer getInputStream() {
480      return inputStream;
481    }
482
483    /**
484      * Sets the value of the 'inputStream' field.
485      * @param value The value of 'inputStream'.
486      * @return This builder.
487      */
488    public org.apache.reef.webserver.AvroHttpRequest.Builder setInputStream(java.nio.ByteBuffer value) {
489      validate(fields()[5], value);
490      this.inputStream = value;
491      fieldSetFlags()[5] = true;
492      return this;
493    }
494
495    /**
496      * Checks whether the 'inputStream' field has been set.
497      * @return True if the 'inputStream' field has been set, false otherwise.
498      */
499    public boolean hasInputStream() {
500      return fieldSetFlags()[5];
501    }
502
503
504    /**
505      * Clears the value of the 'inputStream' field.
506      * @return This builder.
507      */
508    public org.apache.reef.webserver.AvroHttpRequest.Builder clearInputStream() {
509      inputStream = null;
510      fieldSetFlags()[5] = false;
511      return this;
512    }
513
514    @Override
515    public AvroHttpRequest build() {
516      try {
517        AvroHttpRequest record = new AvroHttpRequest();
518        record.header = fieldSetFlags()[0] ? this.header : (java.util.List<org.apache.reef.webserver.HeaderEntry>) defaultValue(fields()[0]);
519        record.requestUrl = fieldSetFlags()[1] ? this.requestUrl : (java.lang.CharSequence) defaultValue(fields()[1]);
520        record.pathInfo = fieldSetFlags()[2] ? this.pathInfo : (java.lang.CharSequence) defaultValue(fields()[2]);
521        record.queryString = fieldSetFlags()[3] ? this.queryString : (java.lang.CharSequence) defaultValue(fields()[3]);
522        record.httpMethod = fieldSetFlags()[4] ? this.httpMethod : (java.lang.CharSequence) defaultValue(fields()[4]);
523        record.inputStream = fieldSetFlags()[5] ? this.inputStream : (java.nio.ByteBuffer) defaultValue(fields()[5]);
524        return record;
525      } catch (Exception e) {
526        throw new org.apache.avro.AvroRuntimeException(e);
527      }
528    }
529  }
530
531  private static final org.apache.avro.io.DatumWriter
532    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
533
534  @Override public void writeExternal(java.io.ObjectOutput out)
535    throws java.io.IOException {
536    WRITER$.write(this, SpecificData.getEncoder(out));
537  }
538
539  private static final org.apache.avro.io.DatumReader
540    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
541
542  @Override public void readExternal(java.io.ObjectInput in)
543    throws java.io.IOException {
544    READER$.read(this, SpecificData.getDecoder(in));
545  }
546
547}