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.vortex.common.avro;  
007@SuppressWarnings("all")
008@org.apache.avro.specific.AvroGenerated
009public class AvroVortexRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
010  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroVortexRequest\",\"namespace\":\"org.apache.reef.vortex.common.avro\",\"fields\":[{\"name\":\"requestType\",\"type\":{\"type\":\"enum\",\"name\":\"AvroRequestType\",\"symbols\":[\"ExecuteTasklet\",\"CancelTasklet\",\"Aggregate\",\"AggregateExecute\"]}},{\"name\":\"taskletRequest\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"AvroTaskletAggregateExecutionRequest\",\"fields\":[{\"name\":\"taskletId\",\"type\":\"int\"},{\"name\":\"aggregateFunctionId\",\"type\":\"int\"},{\"name\":\"serializedInput\",\"type\":\"bytes\"}]},{\"type\":\"record\",\"name\":\"AvroTaskletAggregationRequest\",\"fields\":[{\"name\":\"aggregateFunctionId\",\"type\":\"int\"},{\"name\":\"serializedUserFunction\",\"type\":\"bytes\"},{\"name\":\"serializedAggregateFunction\",\"type\":\"bytes\"},{\"name\":\"serializedPolicy\",\"type\":\"bytes\"}]},{\"type\":\"record\",\"name\":\"AvroTaskletExecutionRequest\",\"fields\":[{\"name\":\"taskletId\",\"type\":\"int\"},{\"name\":\"serializedUserFunction\",\"type\":\"bytes\"},{\"name\":\"serializedInput\",\"type\":\"bytes\"}]},{\"type\":\"record\",\"name\":\"AvroTaskletCancellationRequest\",\"fields\":[{\"name\":\"taskletId\",\"type\":\"int\"}]}],\"default\":null}]}");
011  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
012  @Deprecated public org.apache.reef.vortex.common.avro.AvroRequestType requestType;
013  @Deprecated public java.lang.Object taskletRequest;
014
015  /**
016   * Default constructor.  Note that this does not initialize fields
017   * to their default values from the schema.  If that is desired then
018   * one should use <code>newBuilder()</code>. 
019   */
020  public AvroVortexRequest() {}
021
022  /**
023   * All-args constructor.
024   */
025  public AvroVortexRequest(org.apache.reef.vortex.common.avro.AvroRequestType requestType, java.lang.Object taskletRequest) {
026    this.requestType = requestType;
027    this.taskletRequest = taskletRequest;
028  }
029
030  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
031  // Used by DatumWriter.  Applications should not call. 
032  public java.lang.Object get(int field$) {
033    switch (field$) {
034    case 0: return requestType;
035    case 1: return taskletRequest;
036    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
037    }
038  }
039  // Used by DatumReader.  Applications should not call. 
040  @SuppressWarnings(value="unchecked")
041  public void put(int field$, java.lang.Object value$) {
042    switch (field$) {
043    case 0: requestType = (org.apache.reef.vortex.common.avro.AvroRequestType)value$; break;
044    case 1: taskletRequest = (java.lang.Object)value$; break;
045    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
046    }
047  }
048
049  /**
050   * Gets the value of the 'requestType' field.
051   */
052  public org.apache.reef.vortex.common.avro.AvroRequestType getRequestType() {
053    return requestType;
054  }
055
056  /**
057   * Sets the value of the 'requestType' field.
058   * @param value the value to set.
059   */
060  public void setRequestType(org.apache.reef.vortex.common.avro.AvroRequestType value) {
061    this.requestType = value;
062  }
063
064  /**
065   * Gets the value of the 'taskletRequest' field.
066   */
067  public java.lang.Object getTaskletRequest() {
068    return taskletRequest;
069  }
070
071  /**
072   * Sets the value of the 'taskletRequest' field.
073   * @param value the value to set.
074   */
075  public void setTaskletRequest(java.lang.Object value) {
076    this.taskletRequest = value;
077  }
078
079  /** Creates a new AvroVortexRequest RecordBuilder */
080  public static org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder newBuilder() {
081    return new org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder();
082  }
083  
084  /** Creates a new AvroVortexRequest RecordBuilder by copying an existing Builder */
085  public static org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder newBuilder(org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder other) {
086    return new org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder(other);
087  }
088  
089  /** Creates a new AvroVortexRequest RecordBuilder by copying an existing AvroVortexRequest instance */
090  public static org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder newBuilder(org.apache.reef.vortex.common.avro.AvroVortexRequest other) {
091    return new org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder(other);
092  }
093  
094  /**
095   * RecordBuilder for AvroVortexRequest instances.
096   */
097  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroVortexRequest>
098    implements org.apache.avro.data.RecordBuilder<AvroVortexRequest> {
099
100    private org.apache.reef.vortex.common.avro.AvroRequestType requestType;
101    private java.lang.Object taskletRequest;
102
103    /** Creates a new Builder */
104    private Builder() {
105      super(org.apache.reef.vortex.common.avro.AvroVortexRequest.SCHEMA$);
106    }
107    
108    /** Creates a Builder by copying an existing Builder */
109    private Builder(org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder other) {
110      super(other);
111      if (isValidValue(fields()[0], other.requestType)) {
112        this.requestType = data().deepCopy(fields()[0].schema(), other.requestType);
113        fieldSetFlags()[0] = true;
114      }
115      if (isValidValue(fields()[1], other.taskletRequest)) {
116        this.taskletRequest = data().deepCopy(fields()[1].schema(), other.taskletRequest);
117        fieldSetFlags()[1] = true;
118      }
119    }
120    
121    /** Creates a Builder by copying an existing AvroVortexRequest instance */
122    private Builder(org.apache.reef.vortex.common.avro.AvroVortexRequest other) {
123            super(org.apache.reef.vortex.common.avro.AvroVortexRequest.SCHEMA$);
124      if (isValidValue(fields()[0], other.requestType)) {
125        this.requestType = data().deepCopy(fields()[0].schema(), other.requestType);
126        fieldSetFlags()[0] = true;
127      }
128      if (isValidValue(fields()[1], other.taskletRequest)) {
129        this.taskletRequest = data().deepCopy(fields()[1].schema(), other.taskletRequest);
130        fieldSetFlags()[1] = true;
131      }
132    }
133
134    /** Gets the value of the 'requestType' field */
135    public org.apache.reef.vortex.common.avro.AvroRequestType getRequestType() {
136      return requestType;
137    }
138    
139    /** Sets the value of the 'requestType' field */
140    public org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder setRequestType(org.apache.reef.vortex.common.avro.AvroRequestType value) {
141      validate(fields()[0], value);
142      this.requestType = value;
143      fieldSetFlags()[0] = true;
144      return this; 
145    }
146    
147    /** Checks whether the 'requestType' field has been set */
148    public boolean hasRequestType() {
149      return fieldSetFlags()[0];
150    }
151    
152    /** Clears the value of the 'requestType' field */
153    public org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder clearRequestType() {
154      requestType = null;
155      fieldSetFlags()[0] = false;
156      return this;
157    }
158
159    /** Gets the value of the 'taskletRequest' field */
160    public java.lang.Object getTaskletRequest() {
161      return taskletRequest;
162    }
163    
164    /** Sets the value of the 'taskletRequest' field */
165    public org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder setTaskletRequest(java.lang.Object value) {
166      validate(fields()[1], value);
167      this.taskletRequest = value;
168      fieldSetFlags()[1] = true;
169      return this; 
170    }
171    
172    /** Checks whether the 'taskletRequest' field has been set */
173    public boolean hasTaskletRequest() {
174      return fieldSetFlags()[1];
175    }
176    
177    /** Clears the value of the 'taskletRequest' field */
178    public org.apache.reef.vortex.common.avro.AvroVortexRequest.Builder clearTaskletRequest() {
179      taskletRequest = null;
180      fieldSetFlags()[1] = false;
181      return this;
182    }
183
184    @Override
185    public AvroVortexRequest build() {
186      try {
187        AvroVortexRequest record = new AvroVortexRequest();
188        record.requestType = fieldSetFlags()[0] ? this.requestType : (org.apache.reef.vortex.common.avro.AvroRequestType) defaultValue(fields()[0]);
189        record.taskletRequest = fieldSetFlags()[1] ? this.taskletRequest : (java.lang.Object) defaultValue(fields()[1]);
190        return record;
191      } catch (Exception e) {
192        throw new org.apache.avro.AvroRuntimeException(e);
193      }
194    }
195  }
196}