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