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/** Negotiate Java/C# bridge protocol messages. */
012@org.apache.avro.specific.AvroGenerated
013public class Protocol extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
014  private static final long serialVersionUID = 3287133236821797634L;
015  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Protocol\",\"namespace\":\"org.apache.reef.bridge.message\",\"doc\":\"Negotiate Java/C# bridge protocol messages.\",\"fields\":[{\"name\":\"offset\",\"type\":\"int\",\"doc\":\"The index offset of the message identifiers.\"}]}");
016  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
017  /** The index offset of the message identifiers. */
018  @Deprecated public int offset;
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 Protocol() {}
026
027  /**
028   * All-args constructor.
029   * @param offset The index offset of the message identifiers.
030   */
031  public Protocol(java.lang.Integer offset) {
032    this.offset = offset;
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 offset;
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: offset = (java.lang.Integer)value$; break;
049    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
050    }
051  }
052
053  /**
054   * Gets the value of the 'offset' field.
055   * @return The index offset of the message identifiers.
056   */
057  public java.lang.Integer getOffset() {
058    return offset;
059  }
060
061  /**
062   * Sets the value of the 'offset' field.
063   * The index offset of the message identifiers.
064   * @param value the value to set.
065   */
066  public void setOffset(java.lang.Integer value) {
067    this.offset = value;
068  }
069
070  /**
071   * Creates a new Protocol RecordBuilder.
072   * @return A new Protocol RecordBuilder
073   */
074  public static org.apache.reef.bridge.message.Protocol.Builder newBuilder() {
075    return new org.apache.reef.bridge.message.Protocol.Builder();
076  }
077
078  /**
079   * Creates a new Protocol RecordBuilder by copying an existing Builder.
080   * @param other The existing builder to copy.
081   * @return A new Protocol RecordBuilder
082   */
083  public static org.apache.reef.bridge.message.Protocol.Builder newBuilder(org.apache.reef.bridge.message.Protocol.Builder other) {
084    return new org.apache.reef.bridge.message.Protocol.Builder(other);
085  }
086
087  /**
088   * Creates a new Protocol RecordBuilder by copying an existing Protocol instance.
089   * @param other The existing instance to copy.
090   * @return A new Protocol RecordBuilder
091   */
092  public static org.apache.reef.bridge.message.Protocol.Builder newBuilder(org.apache.reef.bridge.message.Protocol other) {
093    return new org.apache.reef.bridge.message.Protocol.Builder(other);
094  }
095
096  /**
097   * RecordBuilder for Protocol instances.
098   */
099  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Protocol>
100    implements org.apache.avro.data.RecordBuilder<Protocol> {
101
102    /** The index offset of the message identifiers. */
103    private int offset;
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.Protocol.Builder other) {
115      super(other);
116      if (isValidValue(fields()[0], other.offset)) {
117        this.offset = data().deepCopy(fields()[0].schema(), other.offset);
118        fieldSetFlags()[0] = true;
119      }
120    }
121
122    /**
123     * Creates a Builder by copying an existing Protocol instance
124     * @param other The existing instance to copy.
125     */
126    private Builder(org.apache.reef.bridge.message.Protocol other) {
127            super(SCHEMA$);
128      if (isValidValue(fields()[0], other.offset)) {
129        this.offset = data().deepCopy(fields()[0].schema(), other.offset);
130        fieldSetFlags()[0] = true;
131      }
132    }
133
134    /**
135      * Gets the value of the 'offset' field.
136      * The index offset of the message identifiers.
137      * @return The value.
138      */
139    public java.lang.Integer getOffset() {
140      return offset;
141    }
142
143    /**
144      * Sets the value of the 'offset' field.
145      * The index offset of the message identifiers.
146      * @param value The value of 'offset'.
147      * @return This builder.
148      */
149    public org.apache.reef.bridge.message.Protocol.Builder setOffset(int value) {
150      validate(fields()[0], value);
151      this.offset = value;
152      fieldSetFlags()[0] = true;
153      return this;
154    }
155
156    /**
157      * Checks whether the 'offset' field has been set.
158      * The index offset of the message identifiers.
159      * @return True if the 'offset' field has been set, false otherwise.
160      */
161    public boolean hasOffset() {
162      return fieldSetFlags()[0];
163    }
164
165
166    /**
167      * Clears the value of the 'offset' field.
168      * The index offset of the message identifiers.
169      * @return This builder.
170      */
171    public org.apache.reef.bridge.message.Protocol.Builder clearOffset() {
172      fieldSetFlags()[0] = false;
173      return this;
174    }
175
176    @Override
177    public Protocol build() {
178      try {
179        Protocol record = new Protocol();
180        record.offset = fieldSetFlags()[0] ? this.offset : (java.lang.Integer) 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}