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