001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.io.watcher.wake.time.event;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroStartTime extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = 7659135925526943403L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroStartTime\",\"namespace\":\"org.apache.reef.io.watcher.wake.time.event\",\"fields\":[{\"name\":\"timestamp\",\"type\":\"long\"}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public long timestamp;
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 AvroStartTime() {}
024
025  /**
026   * All-args constructor.
027   * @param timestamp The new value for timestamp
028   */
029  public AvroStartTime(java.lang.Long timestamp) {
030    this.timestamp = timestamp;
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 timestamp;
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: timestamp = (java.lang.Long)value$; break;
047    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
048    }
049  }
050
051  /**
052   * Gets the value of the 'timestamp' field.
053   * @return The value of the 'timestamp' field.
054   */
055  public java.lang.Long getTimestamp() {
056    return timestamp;
057  }
058
059  /**
060   * Sets the value of the 'timestamp' field.
061   * @param value the value to set.
062   */
063  public void setTimestamp(java.lang.Long value) {
064    this.timestamp = value;
065  }
066
067  /**
068   * Creates a new AvroStartTime RecordBuilder.
069   * @return A new AvroStartTime RecordBuilder
070   */
071  public static org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder newBuilder() {
072    return new org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder();
073  }
074
075  /**
076   * Creates a new AvroStartTime RecordBuilder by copying an existing Builder.
077   * @param other The existing builder to copy.
078   * @return A new AvroStartTime RecordBuilder
079   */
080  public static org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder newBuilder(org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder other) {
081    return new org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder(other);
082  }
083
084  /**
085   * Creates a new AvroStartTime RecordBuilder by copying an existing AvroStartTime instance.
086   * @param other The existing instance to copy.
087   * @return A new AvroStartTime RecordBuilder
088   */
089  public static org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder newBuilder(org.apache.reef.io.watcher.wake.time.event.AvroStartTime other) {
090    return new org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder(other);
091  }
092
093  /**
094   * RecordBuilder for AvroStartTime instances.
095   */
096  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroStartTime>
097    implements org.apache.avro.data.RecordBuilder<AvroStartTime> {
098
099    private long timestamp;
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.watcher.wake.time.event.AvroStartTime.Builder other) {
111      super(other);
112      if (isValidValue(fields()[0], other.timestamp)) {
113        this.timestamp = data().deepCopy(fields()[0].schema(), other.timestamp);
114        fieldSetFlags()[0] = true;
115      }
116    }
117
118    /**
119     * Creates a Builder by copying an existing AvroStartTime instance
120     * @param other The existing instance to copy.
121     */
122    private Builder(org.apache.reef.io.watcher.wake.time.event.AvroStartTime other) {
123            super(SCHEMA$);
124      if (isValidValue(fields()[0], other.timestamp)) {
125        this.timestamp = data().deepCopy(fields()[0].schema(), other.timestamp);
126        fieldSetFlags()[0] = true;
127      }
128    }
129
130    /**
131      * Gets the value of the 'timestamp' field.
132      * @return The value.
133      */
134    public java.lang.Long getTimestamp() {
135      return timestamp;
136    }
137
138    /**
139      * Sets the value of the 'timestamp' field.
140      * @param value The value of 'timestamp'.
141      * @return This builder.
142      */
143    public org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder setTimestamp(long value) {
144      validate(fields()[0], value);
145      this.timestamp = value;
146      fieldSetFlags()[0] = true;
147      return this;
148    }
149
150    /**
151      * Checks whether the 'timestamp' field has been set.
152      * @return True if the 'timestamp' field has been set, false otherwise.
153      */
154    public boolean hasTimestamp() {
155      return fieldSetFlags()[0];
156    }
157
158
159    /**
160      * Clears the value of the 'timestamp' field.
161      * @return This builder.
162      */
163    public org.apache.reef.io.watcher.wake.time.event.AvroStartTime.Builder clearTimestamp() {
164      fieldSetFlags()[0] = false;
165      return this;
166    }
167
168    @Override
169    public AvroStartTime build() {
170      try {
171        AvroStartTime record = new AvroStartTime();
172        record.timestamp = fieldSetFlags()[0] ? this.timestamp : (java.lang.Long) defaultValue(fields()[0]);
173        return record;
174      } catch (Exception e) {
175        throw new org.apache.avro.AvroRuntimeException(e);
176      }
177    }
178  }
179
180  private static final org.apache.avro.io.DatumWriter
181    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
182
183  @Override public void writeExternal(java.io.ObjectOutput out)
184    throws java.io.IOException {
185    WRITER$.write(this, SpecificData.getEncoder(out));
186  }
187
188  private static final org.apache.avro.io.DatumReader
189    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
190
191  @Override public void readExternal(java.io.ObjectInput in)
192    throws java.io.IOException {
193    READER$.read(this, SpecificData.getDecoder(in));
194  }
195
196}