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/** Container message for all Java/CLR bridge messages in the protocol. */
012@org.apache.avro.specific.AvroGenerated
013public class BridgeInterop extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
014  private static final long serialVersionUID = 1683981483945214147L;
015  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"BridgeInterop\",\"namespace\":\"org.apache.reef.bridge.message\",\"doc\":\"Container message for all Java/CLR bridge messages in the protocol.\",\"fields\":[{\"name\":\"sequence\",\"type\":\"long\",\"doc\":\"The unique squence identifier of the message in the protocol stream.\"},{\"name\":\"messageType\",\"type\":{\"type\":\"enum\",\"name\":\"MessageType\",\"doc\":\"An enumeration of all possible Java/C# bridge protocol messages.\",\"symbols\":[\"SetupBridge\",\"SystemOnStart\",\"Acknowledgement\"]},\"doc\":\"The type of the bridge Java/CLR interop message.\"},{\"name\":\"message\",\"type\":[{\"type\":\"record\",\"name\":\"SetupBridge\",\"doc\":\"Notify the C# bridge of the http port of the Java bridge webserver.\",\"fields\":[{\"name\":\"httpServerPortNumber\",\"type\":\"int\",\"doc\":\"The Java bridge http server port number.\"}]},{\"type\":\"record\",\"name\":\"SystemOnStart\",\"doc\":\"Notify the C# bridge the system is now running.\",\"fields\":[{\"name\":\"dateTime\",\"type\":\"long\",\"doc\":\"Date time in seconds as a long since January 1, 1970\"}]},{\"type\":\"record\",\"name\":\"Acknowledgement\",\"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.\"}]},{\"type\":\"array\",\"items\":\"bytes\"}],\"doc\":\"A union which contains the actual message.\"}]}");
016  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
017  /** The unique squence identifier of the message in the protocol stream. */
018  @Deprecated public long sequence;
019  /** The type of the bridge Java/CLR interop message. */
020  @Deprecated public org.apache.reef.bridge.message.MessageType messageType;
021  /** A union which contains the actual message. */
022  @Deprecated public java.lang.Object message;
023
024  /**
025   * Default constructor.  Note that this does not initialize fields
026   * to their default values from the schema.  If that is desired then
027   * one should use <code>newBuilder()</code>.
028   */
029  public BridgeInterop() {}
030
031  /**
032   * All-args constructor.
033   * @param sequence The unique squence identifier of the message in the protocol stream.
034   * @param messageType The type of the bridge Java/CLR interop message.
035   * @param message A union which contains the actual message.
036   */
037  public BridgeInterop(java.lang.Long sequence, org.apache.reef.bridge.message.MessageType messageType, java.lang.Object message) {
038    this.sequence = sequence;
039    this.messageType = messageType;
040    this.message = message;
041  }
042
043  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
044  // Used by DatumWriter.  Applications should not call.
045  public java.lang.Object get(int field$) {
046    switch (field$) {
047    case 0: return sequence;
048    case 1: return messageType;
049    case 2: return message;
050    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
051    }
052  }
053
054  // Used by DatumReader.  Applications should not call.
055  @SuppressWarnings(value="unchecked")
056  public void put(int field$, java.lang.Object value$) {
057    switch (field$) {
058    case 0: sequence = (java.lang.Long)value$; break;
059    case 1: messageType = (org.apache.reef.bridge.message.MessageType)value$; break;
060    case 2: message = (java.lang.Object)value$; break;
061    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
062    }
063  }
064
065  /**
066   * Gets the value of the 'sequence' field.
067   * @return The unique squence identifier of the message in the protocol stream.
068   */
069  public java.lang.Long getSequence() {
070    return sequence;
071  }
072
073  /**
074   * Sets the value of the 'sequence' field.
075   * The unique squence identifier of the message in the protocol stream.
076   * @param value the value to set.
077   */
078  public void setSequence(java.lang.Long value) {
079    this.sequence = value;
080  }
081
082  /**
083   * Gets the value of the 'messageType' field.
084   * @return The type of the bridge Java/CLR interop message.
085   */
086  public org.apache.reef.bridge.message.MessageType getMessageType() {
087    return messageType;
088  }
089
090  /**
091   * Sets the value of the 'messageType' field.
092   * The type of the bridge Java/CLR interop message.
093   * @param value the value to set.
094   */
095  public void setMessageType(org.apache.reef.bridge.message.MessageType value) {
096    this.messageType = value;
097  }
098
099  /**
100   * Gets the value of the 'message' field.
101   * @return A union which contains the actual message.
102   */
103  public java.lang.Object getMessage() {
104    return message;
105  }
106
107  /**
108   * Sets the value of the 'message' field.
109   * A union which contains the actual message.
110   * @param value the value to set.
111   */
112  public void setMessage(java.lang.Object value) {
113    this.message = value;
114  }
115
116  /**
117   * Creates a new BridgeInterop RecordBuilder.
118   * @return A new BridgeInterop RecordBuilder
119   */
120  public static org.apache.reef.bridge.message.BridgeInterop.Builder newBuilder() {
121    return new org.apache.reef.bridge.message.BridgeInterop.Builder();
122  }
123
124  /**
125   * Creates a new BridgeInterop RecordBuilder by copying an existing Builder.
126   * @param other The existing builder to copy.
127   * @return A new BridgeInterop RecordBuilder
128   */
129  public static org.apache.reef.bridge.message.BridgeInterop.Builder newBuilder(org.apache.reef.bridge.message.BridgeInterop.Builder other) {
130    return new org.apache.reef.bridge.message.BridgeInterop.Builder(other);
131  }
132
133  /**
134   * Creates a new BridgeInterop RecordBuilder by copying an existing BridgeInterop instance.
135   * @param other The existing instance to copy.
136   * @return A new BridgeInterop RecordBuilder
137   */
138  public static org.apache.reef.bridge.message.BridgeInterop.Builder newBuilder(org.apache.reef.bridge.message.BridgeInterop other) {
139    return new org.apache.reef.bridge.message.BridgeInterop.Builder(other);
140  }
141
142  /**
143   * RecordBuilder for BridgeInterop instances.
144   */
145  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<BridgeInterop>
146    implements org.apache.avro.data.RecordBuilder<BridgeInterop> {
147
148    /** The unique squence identifier of the message in the protocol stream. */
149    private long sequence;
150    /** The type of the bridge Java/CLR interop message. */
151    private org.apache.reef.bridge.message.MessageType messageType;
152    /** A union which contains the actual message. */
153    private java.lang.Object message;
154
155    /** Creates a new Builder */
156    private Builder() {
157      super(SCHEMA$);
158    }
159
160    /**
161     * Creates a Builder by copying an existing Builder.
162     * @param other The existing Builder to copy.
163     */
164    private Builder(org.apache.reef.bridge.message.BridgeInterop.Builder other) {
165      super(other);
166      if (isValidValue(fields()[0], other.sequence)) {
167        this.sequence = data().deepCopy(fields()[0].schema(), other.sequence);
168        fieldSetFlags()[0] = true;
169      }
170      if (isValidValue(fields()[1], other.messageType)) {
171        this.messageType = data().deepCopy(fields()[1].schema(), other.messageType);
172        fieldSetFlags()[1] = true;
173      }
174      if (isValidValue(fields()[2], other.message)) {
175        this.message = data().deepCopy(fields()[2].schema(), other.message);
176        fieldSetFlags()[2] = true;
177      }
178    }
179
180    /**
181     * Creates a Builder by copying an existing BridgeInterop instance
182     * @param other The existing instance to copy.
183     */
184    private Builder(org.apache.reef.bridge.message.BridgeInterop other) {
185            super(SCHEMA$);
186      if (isValidValue(fields()[0], other.sequence)) {
187        this.sequence = data().deepCopy(fields()[0].schema(), other.sequence);
188        fieldSetFlags()[0] = true;
189      }
190      if (isValidValue(fields()[1], other.messageType)) {
191        this.messageType = data().deepCopy(fields()[1].schema(), other.messageType);
192        fieldSetFlags()[1] = true;
193      }
194      if (isValidValue(fields()[2], other.message)) {
195        this.message = data().deepCopy(fields()[2].schema(), other.message);
196        fieldSetFlags()[2] = true;
197      }
198    }
199
200    /**
201      * Gets the value of the 'sequence' field.
202      * The unique squence identifier of the message in the protocol stream.
203      * @return The value.
204      */
205    public java.lang.Long getSequence() {
206      return sequence;
207    }
208
209    /**
210      * Sets the value of the 'sequence' field.
211      * The unique squence identifier of the message in the protocol stream.
212      * @param value The value of 'sequence'.
213      * @return This builder.
214      */
215    public org.apache.reef.bridge.message.BridgeInterop.Builder setSequence(long value) {
216      validate(fields()[0], value);
217      this.sequence = value;
218      fieldSetFlags()[0] = true;
219      return this;
220    }
221
222    /**
223      * Checks whether the 'sequence' field has been set.
224      * The unique squence identifier of the message in the protocol stream.
225      * @return True if the 'sequence' field has been set, false otherwise.
226      */
227    public boolean hasSequence() {
228      return fieldSetFlags()[0];
229    }
230
231
232    /**
233      * Clears the value of the 'sequence' field.
234      * The unique squence identifier of the message in the protocol stream.
235      * @return This builder.
236      */
237    public org.apache.reef.bridge.message.BridgeInterop.Builder clearSequence() {
238      fieldSetFlags()[0] = false;
239      return this;
240    }
241
242    /**
243      * Gets the value of the 'messageType' field.
244      * The type of the bridge Java/CLR interop message.
245      * @return The value.
246      */
247    public org.apache.reef.bridge.message.MessageType getMessageType() {
248      return messageType;
249    }
250
251    /**
252      * Sets the value of the 'messageType' field.
253      * The type of the bridge Java/CLR interop message.
254      * @param value The value of 'messageType'.
255      * @return This builder.
256      */
257    public org.apache.reef.bridge.message.BridgeInterop.Builder setMessageType(org.apache.reef.bridge.message.MessageType value) {
258      validate(fields()[1], value);
259      this.messageType = value;
260      fieldSetFlags()[1] = true;
261      return this;
262    }
263
264    /**
265      * Checks whether the 'messageType' field has been set.
266      * The type of the bridge Java/CLR interop message.
267      * @return True if the 'messageType' field has been set, false otherwise.
268      */
269    public boolean hasMessageType() {
270      return fieldSetFlags()[1];
271    }
272
273
274    /**
275      * Clears the value of the 'messageType' field.
276      * The type of the bridge Java/CLR interop message.
277      * @return This builder.
278      */
279    public org.apache.reef.bridge.message.BridgeInterop.Builder clearMessageType() {
280      messageType = null;
281      fieldSetFlags()[1] = false;
282      return this;
283    }
284
285    /**
286      * Gets the value of the 'message' field.
287      * A union which contains the actual message.
288      * @return The value.
289      */
290    public java.lang.Object getMessage() {
291      return message;
292    }
293
294    /**
295      * Sets the value of the 'message' field.
296      * A union which contains the actual message.
297      * @param value The value of 'message'.
298      * @return This builder.
299      */
300    public org.apache.reef.bridge.message.BridgeInterop.Builder setMessage(java.lang.Object value) {
301      validate(fields()[2], value);
302      this.message = value;
303      fieldSetFlags()[2] = true;
304      return this;
305    }
306
307    /**
308      * Checks whether the 'message' field has been set.
309      * A union which contains the actual message.
310      * @return True if the 'message' field has been set, false otherwise.
311      */
312    public boolean hasMessage() {
313      return fieldSetFlags()[2];
314    }
315
316
317    /**
318      * Clears the value of the 'message' field.
319      * A union which contains the actual message.
320      * @return This builder.
321      */
322    public org.apache.reef.bridge.message.BridgeInterop.Builder clearMessage() {
323      message = null;
324      fieldSetFlags()[2] = false;
325      return this;
326    }
327
328    @Override
329    public BridgeInterop build() {
330      try {
331        BridgeInterop record = new BridgeInterop();
332        record.sequence = fieldSetFlags()[0] ? this.sequence : (java.lang.Long) defaultValue(fields()[0]);
333        record.messageType = fieldSetFlags()[1] ? this.messageType : (org.apache.reef.bridge.message.MessageType) defaultValue(fields()[1]);
334        record.message = fieldSetFlags()[2] ? this.message : (java.lang.Object) defaultValue(fields()[2]);
335        return record;
336      } catch (Exception e) {
337        throw new org.apache.avro.AvroRuntimeException(e);
338      }
339    }
340  }
341
342  private static final org.apache.avro.io.DatumWriter
343    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
344
345  @Override public void writeExternal(java.io.ObjectOutput out)
346    throws java.io.IOException {
347    WRITER$.write(this, SpecificData.getEncoder(out));
348  }
349
350  private static final org.apache.avro.io.DatumReader
351    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
352
353  @Override public void readExternal(java.io.ObjectInput in)
354    throws java.io.IOException {
355    READER$.read(this, SpecificData.getDecoder(in));
356  }
357
358}