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